1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Fix arc lint on working copy changes in mercurial repos

Summary:
Previously, running arc lint on a set of changes that only
existed in your working copy threw an exception in mercurial repos.
It was trying to use the revset "...." (i.e. the range from . to .),
which didn't parse. Even if I fix that it still doesn't work because
getRawDiffText did not include the working copy changes (which it does
in git).  I removed the check so the function now acts the same as in
git and arc lint works on working copy changes. I've seen this error before
in other places so hopefully this change will also fix any other areas,
that depended on getRawDiffText working the same as git.

The logic I removed was added in D1954 to support diffing against
uncommited changes.  That workflow should be unchanged.  arc diff will
still prompt the user if there are uncommited changes, and the user can
still choose to abort or continue.

Let me know if I missed something important which makes this a bad idea.

Test Plan:
Edited a file in the working directory of a hg repo.
arc lint
Verified lint ran successfully.

Also ran arc diff and land with and without working copy changes to make sure
they still work.  I'd kill for some tests in this area...

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: dschleimer, bos, sid0, aran, Korvin

Maniphest Tasks: T1631

Differential Revision: https://secure.phabricator.com/D5130
This commit is contained in:
durham 2013-02-26 16:15:29 -08:00
parent 2f09de2e79
commit 0cb1b7efad
2 changed files with 0 additions and 21 deletions

View file

@ -9,7 +9,6 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
private $branch;
private $localCommitInfo;
private $includeDirectoryStateInDiffs;
private $rawDiffCache = array();
private $supportsRebase;
@ -377,15 +376,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
public function getRawDiffText($path) {
$options = $this->getDiffOptions();
// NOTE: In Mercurial, "--rev x" means "diff between x and the working
// copy state", while "--rev x..." means "diff between x and the working
// copy commit" (i.e., from 'x' to '.'). The latter excludes any dirty
// changes in the working copy.
$range = $this->getBaseCommit();
if (!$this->includeDirectoryStateInDiffs) {
$range .= '...';
}
$raw_diff_cache_key = $options.' '.$range.' '.$path;
if (idx($this->rawDiffCache, $raw_diff_cache_key)) {
@ -670,11 +661,6 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
$this->reloadWorkingCopy();
}
public function setIncludeDirectoryStateInDiffs($include) {
$this->includeDirectoryStateInDiffs = $include;
return $this;
}
public function getCommitSummary($commit) {
if ($commit == 'null') {
return '(The Empty Void)';

View file

@ -660,12 +660,6 @@ EOTEXT
$this->requireCleanWorkingCopy();
} catch (ArcanistUncommittedChangesException $ex) {
if ($repository_api instanceof ArcanistMercurialAPI) {
// Some Mercurial users prefer to use it like SVN, where they don't
// commit changes before sending them for review. This would be a
// pretty bad workflow in Git, but Mercurial users are significantly
// more expert at change management.
$use_dirty_changes = false;
if ($this->getArgument('uncommitted')) {
// OK.
@ -680,7 +674,6 @@ EOTEXT
}
}
$repository_api->setIncludeDirectoryStateInDiffs(true);
$this->haveUncommittedChanges = true;
} else {
throw $ex;