mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Search for SVN commit in Git SVN repository
Summary: `arc patch` currently warns about "This diff is against commit svn+ssh://... but the commit is nowhere in the working copy" in Git SVN repository. Test Plan: $ arc patch # in Git SVN repository $ svn find-rev r121212112 # invalid revision Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3539
This commit is contained in:
parent
e58e408129
commit
36acc9a01d
1 changed files with 14 additions and 3 deletions
|
@ -384,8 +384,17 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
}
|
||||
|
||||
public function getCanonicalRevisionName($string) {
|
||||
list($stdout) = $this->execxLocal('show -s --format=%C %s',
|
||||
'%H', $string);
|
||||
$match = null;
|
||||
if (preg_match('/@([0-9]+)$/', $string, $match)) {
|
||||
list($stdout) = $this->execxLocal(
|
||||
'svn find-rev r%d',
|
||||
$match[1]);
|
||||
} else {
|
||||
list($stdout) = $this->execxLocal(
|
||||
'show -s --format=%C %s',
|
||||
'%H',
|
||||
$string);
|
||||
}
|
||||
return rtrim($stdout);
|
||||
}
|
||||
|
||||
|
@ -682,7 +691,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
|
||||
public function hasLocalCommit($commit) {
|
||||
try {
|
||||
$this->getCanonicalRevisionName($commit);
|
||||
if (!$this->getCanonicalRevisionName($commit)) {
|
||||
return false;
|
||||
}
|
||||
} catch (CommandException $exception) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue