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

Fix an issue with pulling Subversion blame data

Summary:
Fixes T4067. The way `DiffusionCommitQuery` works prevents it from loading SVN identifiers in some cases without additional constraints, since "12345" might be an SVN revision 12345, or it might be the first 5 characters of a Git commit hash.

Introduce `withRepository()` as a shorthand for `withDefaultRepository()` + `withRepositoryIDs()`. This tells the query to:

- Only look in the given repository; and
- use the more liberal identifier resolution rules while doing so.

The practical impact this has is that blame tooltips in SVN work again. The other queries which are fixed here were never run in SVN (which doesn't have first-class branches or tags); I've cleaned them up only for completeness.

Test Plan:
- Viewed blame in SVN, saw information again instead of empty tooltip.
- Viewed brnaches/tags in Mercurial and Git.

{F79226}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4067

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

+17 -6
+1 -1
src/applications/diffusion/controller/DiffusionBranchTableController.php
··· 36 36 $commits = id(new DiffusionCommitQuery()) 37 37 ->setViewer($viewer) 38 38 ->withIdentifiers(mpull($branches, 'getHeadCommitIdentifier')) 39 - ->withRepositoryIDs(array($repository->getID())) 39 + ->withRepository($repository) 40 40 ->execute(); 41 41 42 42 $view = id(new DiffusionBranchTableView())
+1 -1
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 555 555 if ($commits) { 556 556 $commits = id(new DiffusionCommitQuery()) 557 557 ->setViewer($viewer) 558 - ->withRepositoryIDs(array($drequest->getRepository()->getID())) 558 + ->withRepository($drequest->getRepository()) 559 559 ->withIdentifiers($commits) 560 560 ->execute(); 561 561 $commits = mpull($commits, null, 'getCommitIdentifier');
+2 -2
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 268 268 $commits = id(new DiffusionCommitQuery()) 269 269 ->setViewer($viewer) 270 270 ->withIdentifiers(mpull($branches, 'getHeadCommitIdentifier')) 271 - ->withRepositoryIDs(array($drequest->getRepository()->getID())) 271 + ->withRepository($drequest->getRepository()) 272 272 ->execute(); 273 273 274 274 $table = id(new DiffusionBranchTableView()) ··· 332 332 $commits = id(new DiffusionCommitQuery()) 333 333 ->setViewer($viewer) 334 334 ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) 335 - ->withRepositoryIDs(array($drequest->getRepository()->getID())) 335 + ->withRepository($drequest->getRepository()) 336 336 ->needCommitData(true) 337 337 ->execute(); 338 338
+1 -1
src/applications/diffusion/controller/DiffusionTagListController.php
··· 50 50 } else { 51 51 $commits = id(new DiffusionCommitQuery()) 52 52 ->setViewer($viewer) 53 - ->withRepositoryIDs(array($repository->getID())) 53 + ->withRepository($repository) 54 54 ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) 55 55 ->needCommitData(true) 56 56 ->execute();
+11
src/applications/diffusion/query/DiffusionCommitQuery.php
··· 52 52 return $this; 53 53 } 54 54 55 + 56 + /** 57 + * Look up commits in a specific repository. This is a shorthand for calling 58 + * @{method:withDefaultRepository} and @{method:withRepositoryIDs}. 59 + */ 60 + public function withRepository(PhabricatorRepository $repository) { 61 + $this->withDefaultRepository($repository); 62 + $this->withRepositoryIDs(array($repository->getID())); 63 + return $this; 64 + } 65 + 55 66 public function needCommitData($need) { 56 67 $this->needCommitData = $need; 57 68 return $this;
+1 -1
src/applications/diffusion/query/DiffusionRenameHistoryQuery.php
··· 81 81 $commit = id(new DiffusionCommitQuery()) 82 82 ->setViewer($this->viewer) 83 83 ->withIdentifiers(array($commit_identifier)) 84 - ->withDefaultRepository($this->request->getRepository()) 84 + ->withRepository($this->request->getRepository()) 85 85 ->executeOne(); 86 86 return $commit->getID(); 87 87 }