Page MenuHomePhabricator

D8502.id.diff
No OneTemporary

D8502.id.diff

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
@@ -1283,6 +1283,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',
@@ -3962,6 +3963,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

Mime Type
text/plain
Expires
Oct 15 2024, 9:32 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714517
Default Alt Text
D8502.id.diff (4 KB)

Event Timeline