]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't ask user to use saved message in `arc diff --verbatim`
authorvrana <jakubv@fb.com>
Fri, 4 May 2012 07:08:42 +0000 (00:08 -0700)
committervrana <jakubv@fb.com>
Fri, 4 May 2012 19:56:31 +0000 (12:56 -0700)
Test Plan:
Cancel `arc diff`.
Verify that the message is created.
Run `arc diff --verbatim` and see no reuse message question.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2390

src/workflow/diff/ArcanistDiffWorkflow.php

index c3f38e5f6f96956d5709f28d19ebbd2e8eb3e7be..283bdab7d7caa555d3315148890aa13b52e88321 100644 (file)
@@ -1290,33 +1290,35 @@ EOTEXT
 
     $template = null;
 
-    $saved = $this->readScratchFile('create-message');
-    if ($saved) {
-      $where = $this->getReadableScratchFilePath('create-message');
-
-      $preview = explode("\n", $saved);
-      $preview = array_shift($preview);
-      $preview = trim($preview);
-      $preview = phutil_utf8_shorten($preview, 64);
-
-      if ($preview) {
-        $preview = "Message begins:\n\n       {$preview}\n\n";
-      } else {
-        $preview = null;
-      }
+    if (!$this->getArgument('verbatim')) {
+      $saved = $this->readScratchFile('create-message');
+      if ($saved) {
+        $where = $this->getReadableScratchFilePath('create-message');
+
+        $preview = explode("\n", $saved);
+        $preview = array_shift($preview);
+        $preview = trim($preview);
+        $preview = phutil_utf8_shorten($preview, 64);
+
+        if ($preview) {
+          $preview = "Message begins:\n\n       {$preview}\n\n";
+        } else {
+          $preview = null;
+        }
 
-      echo
-        "You have a saved revision message in '{$where}'.\n".
-        "{$preview}".
-        "You can use this message, or discard it.";
+        echo
+          "You have a saved revision message in '{$where}'.\n".
+          "{$preview}".
+          "You can use this message, or discard it.";
 
-      $use = phutil_console_confirm(
-        "Do you want to use this message?",
-        $default_no = false);
-      if ($use) {
-        $template = $saved;
-      } else {
-        $this->removeScratchFile('create-message');
+        $use = phutil_console_confirm(
+          "Do you want to use this message?",
+          $default_no = false);
+        if ($use) {
+          $template = $saved;
+        } else {
+          $this->removeScratchFile('create-message');
+        }
       }
     }