]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use phutil_console_confirm() correctly, not vestigal $this->confirm().
authorepriestley <epriestley@javelinjs.com>
Sat, 19 Mar 2011 19:15:28 +0000 (12:15 -0700)
committerepriestley <epriestley@javelinjs.com>
Sat, 19 Mar 2011 19:16:47 +0000 (12:16 -0700)
Summary:

Test Plan:
$ arc patch --diff 553961

    Patch deletes file 'html/miniprofile.php', but the file does not exist in
    the working copy. Continue anyway? [y/N] y

    Patch deletes file 'html/index.php', but the file does not exist in the
    working copy. Continue anyway? [y/N] y

 OKAY  Successfully applied patch to the working copy.

Reviewers:

CC:

src/workflow/patch/ArcanistPatchWorkflow.php
src/workflow/patch/__init__.php

index 963f50cb0180272429ebb702917ec4a90924285b..b9926f55a6efd42ccdb320f4f78cdf77b423be6c 100644 (file)
@@ -199,9 +199,12 @@ EOTEXT
             $path = $change->getCurrentPath();
             $fpath = $repository_api->getPath($path);
             if (!@file_exists($fpath)) {
-              $this->confirm(
+              $ok = phutil_console_confirm(
                 "Patch deletes file '{$path}', but the file does not exist in ".
                 "the working copy. Continue anyway?");
+              if (!$ok) {
+                throw new ArcanistUserAbortException();
+              }
             } else {
               $deletes[] = $change->getCurrentPath();
             }
@@ -218,9 +221,12 @@ EOTEXT
               } else {
                 $verbs = 'moves';
               }
-              $this->confirm(
+              $ok = phutil_console_confirm(
                 "Patch {$verbs} '{$path}' to '{$cpath}', but source path ".
                 "does not exist in the working copy. Continue anyway?");
+              if (!$ok) {
+                throw new ArcanistUserAbortException();
+              }
             } else {
               $copies[] = array(
                 $change->getOldPath(),
index 54f5444220b0984175443c2e15ea47b43c6e4875..3449002af02834b2ff9b135ec0de96f352f73148 100644 (file)
@@ -7,6 +7,7 @@
 
 
 phutil_require_module('arcanist', 'exception/usage');
+phutil_require_module('arcanist', 'exception/usage/userabort');
 phutil_require_module('arcanist', 'parser/bundle');
 phutil_require_module('arcanist', 'parser/diff/changetype');
 phutil_require_module('arcanist', 'workflow/base');