mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 05:50:54 +01:00
Make minor correctness changes to some "arc patch" command execution
Summary: Since I'm in here for PHI1083: - Add some "--" so we get correct behavior when you have a file named "master", a branch named "README.txt", etc. - Stop using "%C" unnecessarily. - Fix some untranslatable strings. Test Plan: Ran `arc patch` a couple of times, ran the variations of `git` commands to catch anything weird with "--" handling. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20254
This commit is contained in:
parent
73804f0039
commit
9830c9316d
1 changed files with 15 additions and 14 deletions
|
@ -741,21 +741,26 @@ EOTEXT
|
||||||
$repository_api->execPassthru('submodule update --init --recursive');
|
$repository_api->execPassthru('submodule update --init --recursive');
|
||||||
|
|
||||||
if ($this->shouldCommit()) {
|
if ($this->shouldCommit()) {
|
||||||
|
$flags = array();
|
||||||
if ($bundle->getFullAuthor()) {
|
if ($bundle->getFullAuthor()) {
|
||||||
$author_cmd = csprintf('--author=%s', $bundle->getFullAuthor());
|
$flags[] = csprintf('--author=%s', $bundle->getFullAuthor());
|
||||||
} else {
|
|
||||||
$author_cmd = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$commit_message = $this->getCommitMessage($bundle);
|
$commit_message = $this->getCommitMessage($bundle);
|
||||||
|
|
||||||
$future = $repository_api->execFutureLocal(
|
$future = $repository_api->execFutureLocal(
|
||||||
'commit -a %C -F - --no-verify',
|
'commit -a %Ls -F - --no-verify',
|
||||||
$author_cmd);
|
$flags);
|
||||||
$future->write($commit_message);
|
$future->write($commit_message);
|
||||||
$future->resolvex();
|
$future->resolvex();
|
||||||
$verb = pht('committed');
|
|
||||||
|
$this->writeOkay(
|
||||||
|
pht('COMMITTED'),
|
||||||
|
pht('Successfully committed patch.'));
|
||||||
} else {
|
} else {
|
||||||
$verb = pht('applied');
|
$this->writeOkay(
|
||||||
|
pht('APPLIED'),
|
||||||
|
pht('Successfully applied patch.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->canBranch() &&
|
if ($this->canBranch() &&
|
||||||
|
@ -765,18 +770,18 @@ EOTEXT
|
||||||
// See PHI1083 and PHI648. Synchronize submodule state after mutating
|
// See PHI1083 and PHI648. Synchronize submodule state after mutating
|
||||||
// the working copy.
|
// the working copy.
|
||||||
|
|
||||||
$repository_api->execxLocal('checkout %s', $original_branch);
|
$repository_api->execxLocal('checkout %s --', $original_branch);
|
||||||
$repository_api->execPassthru('submodule update --init --recursive');
|
$repository_api->execPassthru('submodule update --init --recursive');
|
||||||
|
|
||||||
$ex = null;
|
$ex = null;
|
||||||
try {
|
try {
|
||||||
$repository_api->execxLocal('cherry-pick %s', $new_branch);
|
$repository_api->execxLocal('cherry-pick -- %s', $new_branch);
|
||||||
$repository_api->execPassthru('submodule update --init --recursive');
|
$repository_api->execPassthru('submodule update --init --recursive');
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
$repository_api->execxLocal('branch -D %s', $new_branch);
|
$repository_api->execxLocal('branch -D -- %s', $new_branch);
|
||||||
|
|
||||||
if ($ex) {
|
if ($ex) {
|
||||||
echo phutil_console_format(
|
echo phutil_console_format(
|
||||||
|
@ -786,10 +791,6 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo phutil_console_format(
|
|
||||||
"<bg:green>** %s **</bg> %s\n",
|
|
||||||
pht('OKAY'),
|
|
||||||
pht('Successfully %s patch.', $verb));
|
|
||||||
} else if ($repository_api instanceof ArcanistMercurialAPI) {
|
} else if ($repository_api instanceof ArcanistMercurialAPI) {
|
||||||
$future = $repository_api->execFutureLocal('import --no-commit -');
|
$future = $repository_api->execFutureLocal('import --no-commit -');
|
||||||
$future->write($bundle->toGitPatch());
|
$future->write($bundle->toGitPatch());
|
||||||
|
|
Loading…
Reference in a new issue