1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

Make 'arc diff X' in mercurial match git by using the GCA of X as the base

Summary:
Previously 'arc diff X' with mercurial meant to use X as the base
to diff against.  Now it means use gca(X,working directory) as the base to
diff against.  This matches the git behavior.

Test Plan:
Ran 'arc diff master' on a repo where master was ahead of the feature branch.
Verified that the diff result included only the diffs in the feature branch.

Reviewers: epriestley, sid0, bos, dschleimer

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4865
This commit is contained in:
durham 2013-02-08 07:09:30 -08:00
parent db053e1eb7
commit 4c35af9283
2 changed files with 8 additions and 5 deletions

View file

@ -85,12 +85,15 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
protected function buildBaseCommit($symbolic_commit) {
if ($symbolic_commit !== null) {
try {
$commit = $this->getCanonicalRevisionName($symbolic_commit);
$commit = $this->getCanonicalRevisionName(
hgsprintf('ancestor(%s,.)', $symbolic_commit));
} catch (Exception $ex) {
throw new ArcanistUsageException(
"Commit '{$commit}' is not a valid Mercurial commit identifier.");
}
$this->setBaseCommitExplanation("you specified it explicitly.");
$this->setBaseCommitExplanation("it is the greatest common ancestor of ".
"the working directory and the commit you specified explicitly.");
return $commit;
}

View file

@ -41,9 +41,9 @@ EOTEXT
Supports: git, svn, hg
Generate a Differential diff or revision from local changes.
Under git, you can specify a commit (like __HEAD^^^__ or __master__)
and Differential will generate a diff against the merge base of that
commit and HEAD.
Under git and mercurial, you can specify a commit (like __HEAD^^^__
or __master__) and Differential will generate a diff against the
merge base of that commit and your current working directory parent.
Under svn, you can choose to include only some of the modified files
in the working copy in the diff by specifying their paths. If you