mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-26 23:40:56 +01:00
Make arc patch be less ROFL for mercurial
Summary: pretty easy stuff as mercurial accepts git style patches...! also fixed two issues where we were 1) storing the short hash and 2) storing it with a trailing "\n". This diff makes us store the full hash AND no trailing return character Test Plan: in my mercurial repo <note repo at revision $foo> <did something dumb> hg commit -m "something dumb" arc diff <go to web and fill out stuff for DX> hg checkout $foo arc patch DX <verify patch DX successfully applied!> use conduit console to verify a few diffs were returning the correct full revision hash with a trailing \n Reviewers: epriestley Reviewed By: epriestley CC: aran Maniphest Tasks: T630 Differential Revision: https://secure.phabricator.com/D1431
This commit is contained in:
parent
c5dfa34f10
commit
6c613292f7
2 changed files with 15 additions and 3 deletions
|
@ -33,10 +33,11 @@ class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
|
||||
public function getSourceControlBaseRevision() {
|
||||
list($stdout) = execx(
|
||||
'(cd %s && hg id -ir %s)',
|
||||
'(cd %s && hg log -l 1 --template %s -r %s)',
|
||||
$this->getPath(),
|
||||
'{node}\\n',
|
||||
$this->getRelativeCommit());
|
||||
return $stdout;
|
||||
return rtrim($stdout, "\n");
|
||||
}
|
||||
|
||||
public function getSourceControlPath() {
|
||||
|
|
|
@ -403,7 +403,7 @@ EOTEXT
|
|||
}
|
||||
|
||||
return $patch_err;
|
||||
} else {
|
||||
} else if ($repository_api instanceof ArcanistGitAPI) {
|
||||
$future = new ExecFuture(
|
||||
'(cd %s; git apply --index --reject)',
|
||||
$repository_api->getPath());
|
||||
|
@ -412,6 +412,17 @@ EOTEXT
|
|||
|
||||
echo phutil_console_format(
|
||||
"<bg:green>** OKAY **</bg> Successfully applied patch.\n");
|
||||
} else if ($repository_api instanceof ArcanistMercurialAPI) {
|
||||
$future = new ExecFuture(
|
||||
'(cd %s; hg import --no-commit -)',
|
||||
$repository_api->getPath());
|
||||
$future->write($bundle->toGitPatch());
|
||||
$future->resolvex();
|
||||
|
||||
echo phutil_console_format(
|
||||
"<bg:green>** OKAY **</bg> Successfully applied patch.\n");
|
||||
} else {
|
||||
throw new Exception('Unknown version control system.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue