From efcd70c2d715c1ac63a45026fc4278980a48316a Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 19 Mar 2011 12:15:28 -0700 Subject: [PATCH] Use phutil_console_confirm() correctly, not vestigal $this->confirm(). 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 | 10 ++++++++-- src/workflow/patch/__init__.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/workflow/patch/ArcanistPatchWorkflow.php b/src/workflow/patch/ArcanistPatchWorkflow.php index 963f50cb..b9926f55 100644 --- a/src/workflow/patch/ArcanistPatchWorkflow.php +++ b/src/workflow/patch/ArcanistPatchWorkflow.php @@ -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(), diff --git a/src/workflow/patch/__init__.php b/src/workflow/patch/__init__.php index 54f54442..3449002a 100644 --- a/src/workflow/patch/__init__.php +++ b/src/workflow/patch/__init__.php @@ -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'); -- 2.43.0