]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make all the working-copy-paths errors extremely explicit.
authorepriestley <epriestley@phabricator.com>
Sun, 13 Mar 2011 02:16:15 +0000 (18:16 -0800)
committerepriestley <epriestley@phabricator.com>
Sun, 13 Mar 2011 02:23:52 +0000 (18:23 -0800)
src/__phutil_library_map__.php
src/repository/api/git/ArcanistGitAPI.php
src/workflow/base/ArcanistBaseWorkflow.php

index dd5b4f0ccce4ed88254b0b22cc5690c98522af60..04bb86ce2e9704b0c4d61f118604a47b29cb2b6e 100644 (file)
@@ -50,6 +50,7 @@ phutil_register_library_map(array(
     'ArcanistNoEffectException' => 'exception/usage/noeffect',
     'ArcanistNoEngineException' => 'exception/usage/noengine',
     'ArcanistNoLintLinter' => 'lint/linter/nolint',
+    'ArcanistNoLintTestCaseMisnamed' => 'lint/linter/nolint/__tests__',
     'ArcanistPEP8Linter' => 'lint/linter/pep8',
     'ArcanistPatchWorkflow' => 'workflow/patch',
     'ArcanistPhutilModuleLinter' => 'lint/linter/phutilmodule',
@@ -100,6 +101,7 @@ phutil_register_library_map(array(
     'ArcanistNoEffectException' => 'ArcanistUsageException',
     'ArcanistNoEngineException' => 'ArcanistUsageException',
     'ArcanistNoLintLinter' => 'ArcanistLinter',
+    'ArcanistNoLintTestCaseMisnamed' => 'ArcanistLinterTestCase',
     'ArcanistPEP8Linter' => 'ArcanistLinter',
     'ArcanistPatchWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
index 15f5c952b62426cdc777fb72efd83bee4ffab0d3..cc961d35f0d9d2c6cbf4588dbbb4d83136149fe3 100644 (file)
@@ -182,6 +182,9 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI {
         }
       }
 
+      // TODO: This doesn't list unstaged adds. It's not clear how to get that
+      // list other than "git status --porcelain" and then parsing it. :/
+
       // Find unstaged changes.
       list($stdout) = execx(
         '(cd %s; git ls-files -m)',
index c66c300a1c0e7a46ccc50bb47b9dc7e048645065..aa96dc0e3188da94ef31689210dd450fae02e4c9 100644 (file)
@@ -316,21 +316,26 @@ class ArcanistBaseWorkflow {
   protected function requireCleanWorkingCopy() {
     $api = $this->getRepositoryAPI();
 
+    $working_copy_desc = phutil_console_format(
+      "  Working copy: __%s__\n\n",
+      $api->getPath());
+
     $untracked = $api->getUntrackedChanges();
     if ($this->shouldRequireCleanUntrackedFiles()) {
       if (!empty($untracked)) {
-
-        echo "You have untracked files in this working copy:\n\n".
+        echo "You have untracked files in this working copy.\n\n".
+             $working_copy_desc.
+             "  Untracked files in working copy:\n".
              "    ".implode("\n    ", $untracked)."\n\n";
 
         if ($api instanceof ArcanistGitAPI) {
           echo phutil_console_wrap(
-            "Since you don't have .gitignore rules for these files and have ".
-            "not listed them in .git/info/exclude, you may have forgotten ".
+            "Since you don't have '.gitignore' rules for these files and have ".
+            "not listed them in '.git/info/exclude', you may have forgotten ".
             "to 'git add' them to your commit.");
         } else if ($api instanceof ArcanistSubversionAPI) {
           echo phutil_console_wrap(
-            "Since you don't have svn:ignore rules for these files, you may ".
+            "Since you don't have 'svn:ignore' rules for these files, you may ".
             "have forgotten to 'svn add' them.");
         }
 
@@ -345,27 +350,41 @@ class ArcanistBaseWorkflow {
     if ($incomplete) {
       throw new ArcanistUsageException(
         "You have incompletely checked out directories in this working copy. ".
-        "Fix them before proceeding: \n\n".
+        "Fix them before proceeding.\n\n".
+        $working_copy_desc.
+        "  Incomplete directories in working copy:\n".
         "    ".implode("\n    ", $incomplete)."\n\n".
         "You can fix these paths by running 'svn update' on them.");
     }
 
-    if ($api->getMergeConflicts()) {
+    $conflicts = $api->getMergeConflicts();
+    if ($conflicts) {
       throw new ArcanistUsageException(
         "You have merge conflicts in this working copy. Resolve merge ".
-        "conflicts before proceeding.");
+        "conflicts before proceeding.\n\n".
+        $working_copy_desc.
+        "  Conflicts in working copy:\n".
+        "    ".implode("\n    ", $conflicts)."\n");
     }
 
-    if ($api->getUnstagedChanges()) {
+    $unstaged = $api->getUnstagedChanges();
+    if ($unstaged) {
       throw new ArcanistUsageException(
-        "You have unstaged changes in this branch. Stage and commit (or ".
-        "revert) them before proceeding.");
+        "You have unstaged changes in this working copy. Stage and commit (or ".
+        "revert) them before proceeding.\n\n".
+        $working_copy_desc.
+        "  Unstaged changes in working copy:\n".
+        "    ".implode("\n    ", $unstaged)."\n");
     }
 
-    if ($api->getUncommittedChanges()) {
+    $uncommitted = $api->getUncommittedChanges();
+    if ($uncommitted) {
       throw new ArcanistUsageException(
         "You have uncommitted changes in this branch. Commit (or revert) them ".
-        "before proceeding.");
+        "before proceeding.\n\n".
+        $working_copy_desc.
+        "  Uncommitted changes in working copy\n".
+        "    ".implode("\n    ", $uncommitted)."\n");
     }
   }