@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.

Show "hold reasons" on commit page, not on "Edit" page

Summary:
Depends on D20465. Ref T13277. Currently, when a commit is unpublished, we put a single line about it on the "Edit Commit" page. This is pretty much impossible to find.

Move it to the main page. This treatment is more big/bold than I'd probably like to end up, but we should probably overshoot on the explanatory text until users get used to this behavior.

Also, allow searching for only published / unpublished commits.

Test Plan: {F6395705}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13277

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

+194 -72
+2
src/__phutil_library_map__.php
··· 4408 4408 'PhabricatorRepositoryParsedChange' => 'applications/repository/data/PhabricatorRepositoryParsedChange.php', 4409 4409 'PhabricatorRepositoryPermanentRefsTransaction' => 'applications/repository/xaction/PhabricatorRepositoryPermanentRefsTransaction.php', 4410 4410 'PhabricatorRepositoryPublisher' => 'applications/repository/query/PhabricatorRepositoryPublisher.php', 4411 + 'PhabricatorRepositoryPublisherHoldReason' => 'applications/repository/query/PhabricatorRepositoryPublisherHoldReason.php', 4411 4412 'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php', 4412 4413 'PhabricatorRepositoryPullEvent' => 'applications/repository/storage/PhabricatorRepositoryPullEvent.php', 4413 4414 'PhabricatorRepositoryPullEventPHIDType' => 'applications/repository/phid/PhabricatorRepositoryPullEventPHIDType.php', ··· 10690 10691 'PhabricatorRepositoryParsedChange' => 'Phobject', 10691 10692 'PhabricatorRepositoryPermanentRefsTransaction' => 'PhabricatorRepositoryTransactionType', 10692 10693 'PhabricatorRepositoryPublisher' => 'Phobject', 10694 + 'PhabricatorRepositoryPublisherHoldReason' => 'Phobject', 10693 10695 'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine', 10694 10696 'PhabricatorRepositoryPullEvent' => array( 10695 10697 'PhabricatorRepositoryDAO',
+15
src/applications/audit/query/PhabricatorCommitSearchEngine.php
··· 54 54 $query->withUnreachable($map['unreachable']); 55 55 } 56 56 57 + if ($map['unpublished'] !== null) { 58 + $query->withUnpublished($map['unpublished']); 59 + } 60 + 57 61 if ($map['ancestorsOf']) { 58 62 $query->withAncestorsOf($map['ancestorsOf']); 59 63 } ··· 127 131 pht( 128 132 'Find or exclude unreachable commits which are not ancestors of '. 129 133 'any branch, tag, or ref.')), 134 + id(new PhabricatorSearchThreeStateField()) 135 + ->setLabel(pht('Unpublished')) 136 + ->setKey('unpublished') 137 + ->setOptions( 138 + pht('(Show All)'), 139 + pht('Show Only Unpublished Commits'), 140 + pht('Hide Unpublished Commits')) 141 + ->setDescription( 142 + pht( 143 + 'Find or exclude unpublished commits which are not ancestors of '. 144 + 'any permanent branch, tag, or ref.')), 130 145 id(new PhabricatorSearchStringListField()) 131 146 ->setLabel(pht('Ancestors Of')) 132 147 ->setKey('ancestorsOf')
+63 -17
src/applications/diffusion/controller/DiffusionCommitController.php
··· 116 116 $commit_data = $commit->getCommitData(); 117 117 $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); 118 118 $error_panel = null; 119 + $unpublished_panel = null; 119 120 120 121 $hard_limit = 1000; 121 122 ··· 248 249 249 250 $header->addTag($nonpermanent_tag); 250 251 251 - $this->commitErrors[] = pht( 252 - 'This commit is not reachable from any permanent branch, tag, '. 253 - 'or ref.'); 252 + $holds = $commit_data->newPublisherHoldReasons(); 253 + 254 + $reasons = array(); 255 + foreach ($holds as $hold) { 256 + $reasons[] = array( 257 + phutil_tag('strong', array(), pht('%s:', $hold->getName())), 258 + ' ', 259 + $hold->getSummary(), 260 + ); 261 + } 262 + 263 + if (!$holds) { 264 + $reasons[] = pht('No further details are available.'); 265 + } 266 + 267 + $doc_href = PhabricatorEnv::getDoclink( 268 + 'Diffusion User Guide: Permanent Refs'); 269 + $doc_link = phutil_tag( 270 + 'a', 271 + array( 272 + 'href' => $doc_href, 273 + 'target' => '_blank', 274 + ), 275 + pht('Learn More')); 276 + 277 + $title = array( 278 + pht('Unpublished Commit'), 279 + pht(" \xC2\xB7 "), 280 + $doc_link, 281 + ); 282 + 283 + $unpublished_panel = id(new PHUIInfoView()) 284 + ->setTitle($title) 285 + ->setErrors($reasons) 286 + ->setSeverity(PHUIInfoView::SEVERITY_WARNING); 254 287 } 255 288 256 289 ··· 445 478 ->setWidth((int)$width); 446 479 } 447 480 481 + $description_box = id(new PHUIObjectBoxView()) 482 + ->setHeaderText(pht('Description')) 483 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 484 + ->appendChild($detail_list); 485 + 486 + $detail_box = id(new PHUIObjectBoxView()) 487 + ->setHeaderText(pht('Details')) 488 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 489 + ->appendChild($details); 490 + 448 491 $view = id(new PHUITwoColumnView()) 449 492 ->setHeader($header) 450 493 ->setSubheader($subheader) 451 - ->setMainColumn(array( 452 - $error_panel, 453 - $timeline, 454 - $merge_table, 455 - $info_panel, 456 - )) 457 - ->setFooter(array( 458 - $change_table, 459 - $change_list, 460 - $add_comment, 461 - )) 462 - ->addPropertySection(pht('Description'), $detail_list) 463 - ->addPropertySection(pht('Details'), $details) 464 - ->setCurtain($curtain); 494 + ->setCurtain($curtain) 495 + ->setMainColumn( 496 + array( 497 + $unpublished_panel, 498 + $error_panel, 499 + $description_box, 500 + $detail_box, 501 + $timeline, 502 + $merge_table, 503 + $info_panel, 504 + )) 505 + ->setFooter( 506 + array( 507 + $change_table, 508 + $change_list, 509 + $add_comment, 510 + )); 465 511 466 512 $page = $this->newPage() 467 513 ->setTitle($commit->getDisplayName())
-24
src/applications/diffusion/editor/DiffusionCommitEditEngine.php
··· 113 113 ->setConduitTypeDescription(pht('New auditors.')) 114 114 ->setValue($object->getAuditorPHIDsForEdit()); 115 115 116 - $holds = $data->getPublisherHoldReasons(); 117 - if ($holds) { 118 - $hold_names = array(); 119 - foreach ($holds as $hold) { 120 - $hold_names[] = id(new PhabricatorRepositoryPublisher()) 121 - ->getHoldName($hold); 122 - } 123 - $desc = implode('; ', $hold_names); 124 - 125 - $doc_href = PhabricatorEnv::getDoclink( 126 - 'Diffusion User Guide: Permanent Refs'); 127 - $doc_link = phutil_tag( 128 - 'a', 129 - array( 130 - 'href' => $doc_href, 131 - 'target' => '_blank', 132 - ), 133 - pht('Learn More')); 134 - 135 - $fields[] = id(new PhabricatorStaticEditField()) 136 - ->setLabel(pht('Unpublished')) 137 - ->setValue(array($desc, " \xC2\xB7 ", $doc_link)); 138 - } 139 - 140 116 $actions = DiffusionCommitActionTransaction::loadAllActions(); 141 117 $actions = msortv($actions, 'getCommitActionOrderVector'); 142 118
+21
src/applications/diffusion/query/DiffusionCommitQuery.php
··· 15 15 private $statuses; 16 16 private $packagePHIDs; 17 17 private $unreachable; 18 + private $unpublished; 18 19 19 20 private $needAuditRequests; 20 21 private $needAuditAuthority; ··· 150 151 151 152 public function withUnreachable($unreachable) { 152 153 $this->unreachable = $unreachable; 154 + return $this; 155 + } 156 + 157 + public function withUnpublished($unpublished) { 158 + $this->unpublished = $unpublished; 153 159 return $this; 154 160 } 155 161 ··· 850 856 $conn, 851 857 '(commit.importStatus & %d) = 0', 852 858 PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE); 859 + } 860 + } 861 + 862 + if ($this->unpublished !== null) { 863 + if ($this->unpublished) { 864 + $where[] = qsprintf( 865 + $conn, 866 + '(commit.importStatus & %d) = 0', 867 + PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE); 868 + } else { 869 + $where[] = qsprintf( 870 + $conn, 871 + '(commit.importStatus & %d) = %d', 872 + PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE, 873 + PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE); 853 874 } 854 875 } 855 876
+7
src/applications/diffusion/view/DiffusionHistoryView.php
··· 98 98 foreach ($history as $item) { 99 99 $commit = $item->getCommit(); 100 100 if ($commit) { 101 + 102 + // NOTE: The "commit" objects in the history list may be undiscovered, 103 + // and thus not yet have PHIDs. Only load data for commits with PHIDs. 104 + if (!$commit->getPHID()) { 105 + continue; 106 + } 107 + 101 108 $commits[] = $commit; 102 109 } 103 110 }
-28
src/applications/repository/query/PhabricatorRepositoryPublisher.php
··· 89 89 return $reasons; 90 90 } 91 91 92 - /* -( Rendering )---------------------------------------------------------- */ 93 - 94 - public function getHoldName($hold) { 95 - $map = array( 96 - self::HOLD_IMPORTING => array( 97 - 'name' => pht('Repository Importing'), 98 - ), 99 - self::HOLD_PUBLISHING_DISABLED => array( 100 - 'name' => pht('Repository Publishing Disabled'), 101 - ), 102 - self::HOLD_REF_NOT_BRANCH => array( 103 - 'name' => pht('Not a Branch'), 104 - ), 105 - self::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF => array( 106 - 'name' => pht('Not Reachable from Permanent Ref'), 107 - ), 108 - self::HOLD_UNTRACKED => array( 109 - 'name' => pht('Untracked Ref'), 110 - ), 111 - self::HOLD_NOT_PERMANENT_REF => array( 112 - 'name' => pht('Not a Permanent Ref'), 113 - ), 114 - ); 115 - 116 - $spec = idx($map, $hold, array()); 117 - return idx($spec, 'name', pht('Unknown ("%s")', $hold)); 118 - } 119 - 120 92 }
+78
src/applications/repository/query/PhabricatorRepositoryPublisherHoldReason.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositoryPublisherHoldReason 4 + extends Phobject { 5 + 6 + private $key; 7 + private $spec; 8 + 9 + public static function newForHoldKey($key) { 10 + $spec = self::getSpecForHoldKey($key); 11 + 12 + $hold = new self(); 13 + $hold->key = $key; 14 + $hold->spec = $spec; 15 + 16 + return $hold; 17 + } 18 + 19 + private static function getSpecForHoldKey($key) { 20 + $specs = self::getHoldReasonSpecs(); 21 + 22 + $spec = idx($specs, $key); 23 + 24 + if (!$spec) { 25 + $spec = array( 26 + 'name' => pht('Unknown Hold ("%s")', $key), 27 + ); 28 + } 29 + 30 + return $spec; 31 + } 32 + 33 + public function getName() { 34 + return $this->getProperty('name'); 35 + } 36 + 37 + public function getSummary() { 38 + return $this->getProperty('summary'); 39 + } 40 + 41 + private function getProperty($key, $default = null) { 42 + return idx($this->spec, $key, $default); 43 + } 44 + 45 + private static function getHoldReasonSpecs() { 46 + $map = array( 47 + PhabricatorRepositoryPublisher::HOLD_IMPORTING => array( 48 + 'name' => pht('Repository Importing'), 49 + 'summary' => pht('This repository is still importing.'), 50 + ), 51 + PhabricatorRepositoryPublisher::HOLD_PUBLISHING_DISABLED => array( 52 + 'name' => pht('Publishing Disabled'), 53 + 'summary' => pht('All publishing is disabled for this repository.'), 54 + ), 55 + PhabricatorRepositoryPublisher::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF => 56 + array( 57 + 'name' => pht('Not On Permanent Ref'), 58 + 'summary' => pht( 59 + 'This commit is not an ancestor of any permanent ref.'), 60 + ), 61 + PhabricatorRepositoryPublisher::HOLD_REF_NOT_BRANCH => array( 62 + 'name' => pht('Not a Branch'), 63 + 'summary' => pht('This ref is not a branch.'), 64 + ), 65 + PhabricatorRepositoryPublisher::HOLD_UNTRACKED => array( 66 + 'name' => pht('Untracked Ref'), 67 + 'summary' => pht('This ref is configured as untracked.'), 68 + ), 69 + PhabricatorRepositoryPublisher::HOLD_NOT_PERMANENT_REF => array( 70 + 'name' => pht('Not a Permanent Ref'), 71 + 'summary' => pht('This ref is not configured as a permanent ref.'), 72 + ), 73 + ); 74 + 75 + return $map; 76 + } 77 + 78 + }
+7 -2
src/applications/repository/storage/PhabricatorRepositoryCommitData.php
··· 68 68 ->loadFromArray($dict); 69 69 } 70 70 71 - public function getPublisherHoldReasons() { 71 + public function newPublisherHoldReasons() { 72 72 $holds = $this->getCommitDetail('holdReasons'); 73 73 74 74 // Look for the legacy "autocloseReason" if we don't have a modern list ··· 84 84 $holds = array(); 85 85 } 86 86 87 - return $holds; 87 + foreach ($holds as $key => $reason) { 88 + $holds[$key] = PhabricatorRepositoryPublisherHoldReason::newForHoldKey( 89 + $reason); 90 + } 91 + 92 + return array_values($holds); 88 93 } 89 94 90 95 }
+1 -1
src/view/phui/PHUIInfoView.php
··· 147 147 } 148 148 149 149 $title = $this->title; 150 - if (strlen($title)) { 150 + if ($title || strlen($title)) { 151 151 $title = phutil_tag( 152 152 'h1', 153 153 array(