1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Improve handling of bad branches in Diffusion

Summary:
Fixes T7972.

  - Trap the RefNotFound error which may occur in `getAlternatives()`.
  - Improve error handling in Mercurial.

Test Plan: {F387611}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7972

Differential Revision: https://secure.phabricator.com/D12590
This commit is contained in:
epriestley 2015-04-28 08:56:16 -07:00
parent d816ac0b01
commit ced20d48ea
2 changed files with 10 additions and 1 deletions

View file

@ -204,6 +204,10 @@ final class DiffusionLowLevelResolveRefsQuery
// unclear how to best do that. For now, treat it as a miss instead. // unclear how to best do that. For now, treat it as a miss instead.
continue; continue;
} }
if (preg_match('/unknown revision/', $ex->getStdErr())) {
// No matches for this ref.
continue;
}
throw $ex; throw $ex;
} }

View file

@ -755,7 +755,12 @@ abstract class DiffusionRequest {
public function getRefAlternatives() { public function getRefAlternatives() {
// Make sure we've resolved the reference into a stable commit first. // Make sure we've resolved the reference into a stable commit first.
$this->getStableCommit(); try {
$this->getStableCommit();
} catch (DiffusionRefNotFoundException $ex) {
// If we have a bad reference, just return the empty set of
// alternatives.
}
return $this->refAlternatives; return $this->refAlternatives;
} }