Merge "expandshortcommitquery" and "stablecommitnamequery" into "resolverefs"
Summary: Ref T1493. Diffusion has some garbagey behavior for things we can't resolve. Common cases are: - Looking at a branch that doesn't exist. - Looking at a repository with no branches. - Looking at a commit that doesn't exist. - Looking at an empty repository. In these cases, we generally fatal unhelpfully. I want to untangle this mess. This doesn't help much, but does clean things up a bit. We currently have two separate query paths, "stablecommitname" and "expandshortcommit". These are pretty much doing the same thing -- taking some ref like "master" or "default" or a tag name or part of a commit name, and turning it into a full commit name. Merge them into a single "resolverefs" method. This simplifies the code a fair bit, and gives us better error messages. They still aren't great, but they're like this now: Ref "7498aec194ecf2d333e0e2baddd9d5cdf922d7f1" is ambiguous or does not exist. ...instead of just: ERR-INVALID-COMMIT Test Plan: Looked at Git, Mercurial and Subversion repositories that were empty and non-empty. Looked at branches/heads. Tried to look at invalid commits. Looked at tags. All of this still works, and some behaviors are a bit better than they used to be. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1493 Differential Revision: https://secure.phabricator.com/D7484
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
final class DiffusionExpandCommitQueryException extends Exception {
|
||||
const CODE_UNPARSEABLE = 'unparseable';
|
||||
const CODE_MISSING = 'missing';
|
||||
const CODE_INVALID = 'invalid';
|
||||
|
||||
private $statusCode;
|
||||
public function getStatusCode() {
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
public function __construct($status_code /* ... */) {
|
||||
$args = func_get_args();
|
||||
$this->statusCode = $args[0];
|
||||
|
||||
$args = array_slice($args, 1);
|
||||
call_user_func_array(array('parent', '__construct'), $args);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user