From d2e0dc3e68f7709055504a67332b02a0ca6c3d24 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 9 Aug 2012 18:39:41 -0700 Subject: [PATCH] Improve "arc patch" error messages for mismatched local and diff Summary: We emit a confusing error if there's no ".arcconfig" in the local right now. Test Plan: $ arc patch D3185 This patch is for the 'phabricator' project, but the working copy belongs to the 'phabricatox' project. Still try to apply the patch? [Y/n] $ arc patch D3185 This patch is for the 'phabricator' project, but the working copy does not have an '.arcconfig' file to identify which project it belongs to. Still try to apply the patch? [Y/n] Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D3231 --- src/workflow/ArcanistPatchWorkflow.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php index 5240c320..14c8d66f 100644 --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -692,10 +692,18 @@ EOTEXT // this means $source is SOURCE_PATCH || SOURCE_BUNDLE w/ $version = 0 // they don't come with a project id so just do nothing } else if ($bundle_project_id != $working_copy_project_id) { + if ($working_copy_project_id) { + $issue = + "This patch is for the '{$bundle_project_id}' project, but the ". + "working copy belongs to the '{$working_copy_project_id}' project."; + } else { + $issue = + "This patch is for the '{$bundle_project_id}' project, but the ". + "working copy does not have an '.arcconfig' file to identify which ". + "project it belongs to."; + } $ok = phutil_console_confirm( - "This diff is for the '{$bundle_project_id}' project but the working ". - "copy belongs to the '{$working_copy_project_id}' project. ". - "Still try to apply it?", + "{$issue} Still try to apply the patch?", $default_no = false ); if (!$ok) {