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

When a revision is accepted but has open dependencies, show a note in the list UI

Summary:
Ref T10939. I don't think this is hugely important, but it doesn't clutter things up much and it's nice as a hint.

T4055 was the original request specifically asking for this. It wanted a separate bucket, but I think this use case isn't common/strong enough to justify that.

I would like to improve Differential's "X depends on Y" feature in the long term. We don't tend to use/need it much, but it could easily do a better and more automatic job of supporting review of a group of revisions.

Test Plan: {F1426636}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10939

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

+75
+55
src/applications/differential/query/DifferentialRevisionSearchEngine.php
··· 153 153 154 154 $bucket = $this->getResultBucket($query); 155 155 156 + $unlanded = $this->loadUnlandedDependencies($revisions); 157 + 156 158 $views = array(); 157 159 if ($bucket) { 158 160 $bucket->setViewer($viewer); ··· 187 189 188 190 foreach ($views as $view) { 189 191 $view->setHandles($handles); 192 + $view->setUnlandedDependencies($unlanded); 190 193 } 191 194 192 195 if (count($views) == 1) { ··· 221 224 ->addAction($create_button); 222 225 223 226 return $view; 227 + } 228 + 229 + private function loadUnlandedDependencies(array $revisions) { 230 + $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED; 231 + 232 + $phids = array(); 233 + foreach ($revisions as $revision) { 234 + if ($revision->getStatus() != $status_accepted) { 235 + continue; 236 + } 237 + 238 + $phids[] = $revision->getPHID(); 239 + } 240 + 241 + if (!$phids) { 242 + return array(); 243 + } 244 + 245 + $query = id(new PhabricatorEdgeQuery()) 246 + ->withSourcePHIDs($phids) 247 + ->withEdgeTypes( 248 + array( 249 + DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST, 250 + )); 251 + 252 + $query->execute(); 253 + 254 + $revision_phids = $query->getDestinationPHIDs(); 255 + if (!$revision_phids) { 256 + return array(); 257 + } 258 + 259 + $viewer = $this->requireViewer(); 260 + 261 + $blocking_revisions = id(new DifferentialRevisionQuery()) 262 + ->setViewer($viewer) 263 + ->withPHIDs($revision_phids) 264 + ->withStatus(DifferentialRevisionQuery::STATUS_OPEN) 265 + ->execute(); 266 + $blocking_revisions = mpull($blocking_revisions, null, 'getPHID'); 267 + 268 + $result = array(); 269 + foreach ($revisions as $revision) { 270 + $revision_phid = $revision->getPHID(); 271 + $blocking_phids = $query->getDestinationPHIDs(array($revision_phid)); 272 + $blocking = array_select_keys($blocking_revisions, $blocking_phids); 273 + if ($blocking) { 274 + $result[$revision_phid] = $blocking; 275 + } 276 + } 277 + 278 + return $result; 224 279 } 225 280 226 281 }
+20
src/applications/differential/view/DifferentialRevisionListView.php
··· 12 12 private $noDataString; 13 13 private $noBox; 14 14 private $background = null; 15 + private $unlandedDependencies = array(); 16 + 17 + public function setUnlandedDependencies(array $unlanded_dependencies) { 18 + $this->unlandedDependencies = $unlanded_dependencies; 19 + return $this; 20 + } 21 + 22 + public function getUnlandedDependencies() { 23 + return $this->unlandedDependencies; 24 + } 15 25 16 26 public function setNoDataString($no_data_string) { 17 27 $this->noDataString = $no_data_string; ··· 120 130 // Author 121 131 $author_handle = $this->handles[$revision->getAuthorPHID()]; 122 132 $item->addByline(pht('Author: %s', $author_handle->renderLink())); 133 + 134 + $unlanded = idx($this->unlandedDependencies, $phid); 135 + if ($unlanded) { 136 + $item->addAttribute( 137 + array( 138 + id(new PHUIIconView())->setIcon('fa-chain-broken', 'red'), 139 + ' ', 140 + pht('Open Dependencies'), 141 + )); 142 + } 123 143 124 144 $reviewers = array(); 125 145 // TODO: As above, this should be based on `getReviewerStatus()`.