@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Do not publish/notify about commits which are not reachable from any "Autoclose" ref

Summary:
Depends on D20418. Ref T13277. Fixes T11314.

Currently, when you push commits to some arbitrary ref or tag (like `refs/pull/123` on GitHub, `refs/tags/phabricator/diff/123` on Phabricator, or `refs/changes/whatever` on Gerrit), we do not "autoclose" related objects. This means that we don't process `Ref T123` to create links to tasks, and don't process `Differential Revision: xyz` to close revisions.

However, we //do// still publish these commits. "Publish" means: trigger audits, publish feed stories, and run Herald rules.

- Stop publishing these commits.
- In the UI, show these commits as "Not Permanent" with a note that they are "Not [on any permanent branch]."

These commits will publish and autoclose if they ever become reachable from an "autoclose" ref (most commonly, if they are later merged to "master").

Test Plan:
- Pushed a commit to `refs/tags/quack`.
- Before: got a feed story.
- After: no feed story, UI shows commit as "Not Permanent".

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13277, T11314

Differential Revision: https://secure.phabricator.com/D20419

+33 -5
+2 -2
src/applications/audit/editor/PhabricatorAuditEditor.php
··· 718 718 switch ($xaction->getTransactionType()) { 719 719 case PhabricatorAuditTransaction::TYPE_COMMIT: 720 720 $repository = $object->getRepository(); 721 - if (!$repository->shouldPublish()) { 721 + if (!$repository->shouldPublishCommit($object)) { 722 722 return false; 723 723 } 724 724 return true; ··· 779 779 // TODO: They should, and then we should simplify this. 780 780 $repository = $object->getRepository($assert_attached = false); 781 781 if ($repository != PhabricatorLiskDAO::ATTACHABLE) { 782 - if (!$repository->shouldPublish()) { 782 + if (!$repository->shouldPublishCommit($object)) { 783 783 return false; 784 784 } 785 785 }
+13
src/applications/diffusion/controller/DiffusionCommitController.php
··· 240 240 'reachable from any branch, tag, or ref.'); 241 241 } 242 242 } 243 + if (!$commit->isPermanentCommit()) { 244 + $nonpermanent_tag = id(new PHUITagView()) 245 + ->setType(PHUITagView::TYPE_SHADE) 246 + ->setName(pht('Not Permanent')) 247 + ->setColor(PHUITagView::COLOR_ORANGE); 248 + 249 + $header->addTag($nonpermanent_tag); 250 + 251 + $this->commitErrors[] = pht( 252 + 'This commit is not reachable from any permanent branch, tag, '. 253 + 'or ref.'); 254 + } 255 + 243 256 244 257 if ($this->getCommitErrors()) { 245 258 $error_panel = id(new PHUIInfoView())
+13 -2
src/applications/repository/storage/PhabricatorRepository.php
··· 1055 1055 return true; 1056 1056 } 1057 1057 1058 + public function shouldPublishCommit(PhabricatorRepositoryCommit $commit) { 1059 + if (!$this->shouldPublish()) { 1060 + return false; 1061 + } 1062 + 1063 + if (!$commit->isPermanentCommit()) { 1064 + return false; 1065 + } 1066 + 1067 + return true; 1068 + } 1069 + 1058 1070 1059 1071 /* -( Autoclose )---------------------------------------------------------- */ 1060 1072 ··· 1152 1164 throw new Exception(pht('Unrecognized version control system.')); 1153 1165 } 1154 1166 1155 - $closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE; 1156 - if (!$commit->isPartiallyImported($closeable_flag)) { 1167 + if (!$commit->isPermanentCommit()) { 1157 1168 return self::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH; 1158 1169 } 1159 1170
+4
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 496 496 return $this->getAuditStatusObject()->isAudited(); 497 497 } 498 498 499 + public function isPermanentCommit() { 500 + return (bool)$this->isPartiallyImported(self::IMPORTED_CLOSEABLE); 501 + } 502 + 499 503 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 500 504 501 505 public function getCapabilities() {
+1 -1
src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php
··· 30 30 PhabricatorRepositoryCommit $commit) { 31 31 $viewer = PhabricatorUser::getOmnipotentUser(); 32 32 33 - if (!$repository->shouldPublish()) { 33 + if (!$repository->shouldPublishCommit($commit)) { 34 34 return; 35 35 } 36 36