1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

Make --auto creates actually work in SVN and HG

Summary:
--auto doesn't work right now on the implicit --create pathway in SVN and HG because we hit these conditions.

Also improve a message.

Test Plan: Ran "arc diff" in unaffiliated working copies in HG and SVN.

Reviewers: svemir, btrahan, vrana, jungejason

Reviewed By: svemir

CC: aran

Differential Revision: https://secure.phabricator.com/D2187
This commit is contained in:
epriestley 2012-04-10 12:06:41 -07:00
parent 1c81cd7615
commit 55dce2beeb

View file

@ -289,6 +289,24 @@ EOTEXT
'hg', 'hg',
), ),
), ),
'verbatim' => array(
'help' => 'Try to use the working copy commit message verbatim when '.
'creating a revision, without prompting to edit it.',
'supports' => array(
'hg',
'git',
),
'conflicts' => array(
'use-commit-message' => true,
'update' => true,
'only' => true,
'preview' => true,
'raw' => true,
'raw-command' => true,
'message' => true,
'message-file' => true,
),
),
'*' => 'paths', '*' => 'paths',
); );
} }
@ -521,15 +539,6 @@ EOTEXT
return true; return true;
} }
$repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistSubversionAPI) {
return true;
}
if ($repository_api instanceof ArcanistMercurialAPI) {
return true;
}
if ($this->isHistoryImmutable()) { if ($this->isHistoryImmutable()) {
return true; return true;
} }
@ -1205,7 +1214,7 @@ EOTEXT
$is_update = $revision['id']; $is_update = $revision['id'];
} else { } else {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"There are several revisions in the specified commit range:\n\n". "There are several revisions which match the working copy:\n\n".
$this->renderRevisionList($revisions)."\n". $this->renderRevisionList($revisions)."\n".
"Use '--update' to choose one, or '--create' to create a new ". "Use '--update' to choose one, or '--create' to create a new ".
"revision."); "revision.");
@ -1313,6 +1322,7 @@ EOTEXT
} }
$done = false; $done = false;
$first = true;
while (!$done) { while (!$done) {
$template = rtrim($template)."\n\n"; $template = rtrim($template)."\n\n";
foreach ($issues as $issue) { foreach ($issues as $issue) {
@ -1320,13 +1330,17 @@ EOTEXT
} }
$template .= "\n"; $template .= "\n";
if ($first && $this->getArgument('verbatim') && !$template_is_default) {
$new_template = $template;
} else {
$new_template = id(new PhutilInteractiveEditor($template)) $new_template = id(new PhutilInteractiveEditor($template))
->setName('new-commit') ->setName('new-commit')
->editInteractively(); ->editInteractively();
}
$first = false;
if ($template_is_default && ($new_template == $template)) { if ($template_is_default && ($new_template == $template)) {
throw new ArcanistUsageException( throw new ArcanistUsageException("Template not edited.");
"Template not edited.");
} }
$template = preg_replace('/^\s*#.*$/m', '', $new_template); $template = preg_replace('/^\s*#.*$/m', '', $new_template);