Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14009666
D8502.id20170.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8502.id20170.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1286,6 +1286,7 @@
'PhabricatorChatLogQuery' => 'applications/chatlog/PhabricatorChatLogQuery.php',
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
+ 'PhabricatorCommitTagsField' => 'applications/repository/customfield/PhabricatorCommitTagsField.php',
'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php',
'PhabricatorConduitAPIController' => 'applications/conduit/controller/PhabricatorConduitAPIController.php',
'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php',
@@ -3968,6 +3969,7 @@
'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
+ 'PhabricatorCommitTagsField' => 'PhabricatorCommitCustomField',
'PhabricatorCommonPasswords' => 'Phobject',
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_tagsquery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_tagsquery_Method.php
--- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_tagsquery_Method.php
+++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_tagsquery_Method.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group conduit
- */
final class ConduitAPI_diffusion_tagsquery_Method
extends ConduitAPI_diffusion_abstractquery_Method {
@@ -38,12 +35,14 @@
$all_tags = $this->loadGitTagList();
$all_tags = mpull($all_tags, null, 'getName');
+
if ($name_filter !== null) {
$all_tags = array_intersect_key($all_tags, array_fuse($name_filter));
}
if ($commit_filter !== null) {
- $all_tags = array_intersect_key($all_tags, array_fuse($commit_filter));
+ $all_tags = array_intersect_key($all_tags, $commit_filter);
}
+
$tags = array_values($all_tags);
$offset = $request->getValue('offset');
@@ -151,4 +150,14 @@
return $tags;
}
+ protected function getMercurialResult(ConduitAPIRequest $request) {
+ // For now, we don't support Mercurial tags via API.
+ return array();
+ }
+
+ protected function getSVNResult(ConduitAPIRequest $request) {
+ // Subversion has no meaningful concept of tags.
+ return array();
+ }
+
}
diff --git a/src/applications/repository/customfield/PhabricatorCommitTagsField.php b/src/applications/repository/customfield/PhabricatorCommitTagsField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/repository/customfield/PhabricatorCommitTagsField.php
@@ -0,0 +1,37 @@
+<?php
+
+final class PhabricatorCommitTagsField
+ extends PhabricatorCommitCustomField {
+
+ public function getFieldKey() {
+ return 'diffusion:tags';
+ }
+
+ public function shouldAppearInApplicationTransactions() {
+ return true;
+ }
+
+ public function buildApplicationTransactionMailBody(
+ PhabricatorApplicationTransaction $xaction,
+ PhabricatorMetaMTAMailBody $body) {
+
+ $params = array(
+ 'commit' => $this->getObject()->getCommitIdentifier(),
+ 'callsign' => $this->getObject()->getRepository()->getCallsign(),
+ );
+
+ $tags_raw = id(new ConduitCall('diffusion.tagsquery', $params))
+ ->setUser($this->getViewer())
+ ->execute();
+
+ $tags = DiffusionRepositoryTag::newFromConduit($tags_raw);
+ if (!$tags) {
+ return;
+ }
+ $tag_names = mpull($tags, 'getName');
+ sort($tag_names);
+
+ $body->addTextSection(pht('TAGS'), implode(', ', $tag_names));
+ }
+
+}
diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
--- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
+++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
@@ -167,9 +167,14 @@
->setViewer(PhabricatorUser::getOmnipotentUser())
->readFieldsFromStorage($commit);
foreach ($field_list->getFields() as $field) {
- $field->buildApplicationTransactionMailBody(
- new DifferentialTransaction(), // Bogus object to satisfy typehint.
- $body);
+ try {
+ $field->buildApplicationTransactionMailBody(
+ new DifferentialTransaction(), // Bogus object to satisfy typehint.
+ $body);
+ } catch (Exception $ex) {
+ // Log the exception and continue.
+ phlog($ex);
+ }
}
$body->addTextSection(pht('DIFFERENTIAL REVISION'), $differential);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 10:35 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727899
Default Alt Text
D8502.id20170.diff (4 KB)
Attached To
Mode
D8502: Add a "tags" field to Diffusion commit
Attached
Detach File
Event Timeline
Log In to Comment