]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve "arc patch" error messages for mismatched local and diff
authorepriestley <git@epriestley.com>
Fri, 10 Aug 2012 01:39:41 +0000 (18:39 -0700)
committerepriestley <git@epriestley.com>
Fri, 10 Aug 2012 01:39:41 +0000 (18:39 -0700)
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

index 5240c3205c7963958a8be919582121a59cabfc26..14c8d66fccb3c3e2b4ed0ca65f6f43fe0b5fc32d 100644 (file)
@@ -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) {