From b07a524b4b078cda65a26950a567953084ebc265 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 Apr 2016 09:40:41 -0700 Subject: [PATCH] Fix resolution of commits in SVN repositories without callsigns Summary: Fixes T10721. When trying to load commits by identifier, we would take some bad pathways in Subversion if the repository had no callsign and end up missing the commits. Fix this logic so it works for either callsigns (e.g., if passed `rXyyy`) or with PHIDs if passed repositories. Test Plan: - Viewed SVN commit in a Subversion repository with no callsign. - Added a callsign, looked at it again. - Viewed non-SVN commits in callsign and non-callsign repositories. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10721 Differential Revision: https://secure.phabricator.com/D15607 --- .../diffusion/query/DiffusionCommitQuery.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php index ec76468332..4aeca4c38e 100644 --- a/src/applications/diffusion/query/DiffusionCommitQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitQuery.php @@ -364,7 +364,7 @@ final class DiffusionCommitQuery if ($repo === null) { if ($this->defaultRepository) { - $repo = $this->defaultRepository->getCallsign(); + $repo = $this->defaultRepository->getPHID(); } } @@ -375,7 +375,7 @@ final class DiffusionCommitQuery $bare[] = $commit_identifier; } else { $refs[] = array( - 'callsign' => $repo, + 'repository' => $repo, 'identifier' => $commit_identifier, ); } @@ -392,17 +392,16 @@ final class DiffusionCommitQuery } if ($refs) { - $callsigns = ipull($refs, 'callsign'); + $repositories = ipull($refs, 'repository'); $repos = id(new PhabricatorRepositoryQuery()) ->setViewer($this->getViewer()) - ->withIdentifiers($callsigns); + ->withIdentifiers($repositories); $repos->execute(); $repos = $repos->getIdentifierMap(); foreach ($refs as $key => $ref) { - $repo = idx($repos, $ref['callsign']); - + $repo = idx($repos, $ref['repository']); if (!$repo) { continue; }