From: epriestley Date: Tue, 10 Apr 2012 19:06:41 +0000 (-0700) Subject: Make --auto creates actually work in SVN and HG X-Git-Tag: conduit-4~52 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=55dce2beeb5637a8e66835ba4c2979746c448956;p=arcanist.git 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 --- diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index 27eeeef0..67dddc60 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -289,6 +289,24 @@ EOTEXT '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', ); } @@ -521,15 +539,6 @@ EOTEXT return true; } - $repository_api = $this->getRepositoryAPI(); - if ($repository_api instanceof ArcanistSubversionAPI) { - return true; - } - - if ($repository_api instanceof ArcanistMercurialAPI) { - return true; - } - if ($this->isHistoryImmutable()) { return true; } @@ -1205,7 +1214,7 @@ EOTEXT $is_update = $revision['id']; } else { 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". "Use '--update' to choose one, or '--create' to create a new ". "revision."); @@ -1313,6 +1322,7 @@ EOTEXT } $done = false; + $first = true; while (!$done) { $template = rtrim($template)."\n\n"; foreach ($issues as $issue) { @@ -1320,13 +1330,17 @@ EOTEXT } $template .= "\n"; - $new_template = id(new PhutilInteractiveEditor($template)) - ->setName('new-commit') - ->editInteractively(); + if ($first && $this->getArgument('verbatim') && !$template_is_default) { + $new_template = $template; + } else { + $new_template = id(new PhutilInteractiveEditor($template)) + ->setName('new-commit') + ->editInteractively(); + } + $first = false; if ($template_is_default && ($new_template == $template)) { - throw new ArcanistUsageException( - "Template not edited."); + throw new ArcanistUsageException("Template not edited."); } $template = preg_replace('/^\s*#.*$/m', '', $new_template);