mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-09 16:32:39 +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');
|
||||
|
||||
if ($this->shouldCommit()) {
|
||||
$flags = array();
|
||||
if ($bundle->getFullAuthor()) {
|
||||
$author_cmd = csprintf('--author=%s', $bundle->getFullAuthor());
|
||||
} else {
|
||||
$author_cmd = '';
|
||||
$flags[] = csprintf('--author=%s', $bundle->getFullAuthor());
|
||||
}
|
||||
|
||||
$commit_message = $this->getCommitMessage($bundle);
|
||||
|
||||
$future = $repository_api->execFutureLocal(
|
||||
'commit -a %C -F - --no-verify',
|
||||
$author_cmd);
|
||||
'commit -a %Ls -F - --no-verify',
|
||||
$flags);
|
||||
$future->write($commit_message);
|
||||
$future->resolvex();
|
||||
$verb = pht('committed');
|
||||
|
||||
$this->writeOkay(
|
||||
pht('COMMITTED'),
|
||||
pht('Successfully committed patch.'));
|
||||
} else {
|
||||
$verb = pht('applied');
|
||||
$this->writeOkay(
|
||||
pht('APPLIED'),
|
||||
pht('Successfully applied patch.'));
|
||||
}
|
||||
|
||||
if ($this->canBranch() &&
|
||||
|
@ -765,18 +770,18 @@ EOTEXT
|
|||
// See PHI1083 and PHI648. Synchronize submodule state after mutating
|
||||
// the working copy.
|
||||
|
||||
$repository_api->execxLocal('checkout %s', $original_branch);
|
||||
$repository_api->execxLocal('checkout %s --', $original_branch);
|
||||
$repository_api->execPassthru('submodule update --init --recursive');
|
||||
|
||||
$ex = null;
|
||||
try {
|
||||
$repository_api->execxLocal('cherry-pick %s', $new_branch);
|
||||
$repository_api->execxLocal('cherry-pick -- %s', $new_branch);
|
||||
$repository_api->execPassthru('submodule update --init --recursive');
|
||||
} catch (Exception $ex) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
$repository_api->execxLocal('branch -D %s', $new_branch);
|
||||
$repository_api->execxLocal('branch -D -- %s', $new_branch);
|
||||
|
||||
if ($ex) {
|
||||
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) {
|
||||
$future = $repository_api->execFutureLocal('import --no-commit -');
|
||||
$future->write($bundle->toGitPatch());
|
||||
|
|
Loading…
Reference in a new issue