1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 21:32:43 +01:00

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
This commit is contained in:
epriestley 2016-04-04 09:40:41 -07:00
parent 5f957807a7
commit b07a524b4b

View file

@ -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;
}