]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make some UI things less confusing and reduce the amount of horrific torture
authorepriestley <epriestley@phabricator.com>
Sun, 13 Mar 2011 01:57:35 +0000 (17:57 -0800)
committerepriestley <epriestley@phabricator.com>
Sun, 13 Mar 2011 01:59:15 +0000 (17:59 -0800)
that arc apparently inflicts upon users.

Summary:

Test Plan: .

Reviewers:

CC:

Differential Revision: 223104

src/repository/api/base/ArcanistRepositoryAPI.php
src/repository/api/subversion/ArcanistSubversionAPI.php
src/workflow/base/ArcanistBaseWorkflow.php
src/workflow/base/__init__.php
src/workflow/diff/ArcanistDiffWorkflow.php

index 549c03de953d395df99aaf92e2348c11d29e634e..30df621a3bc8753ffcd5fe45259a77143004a8d4 100644 (file)
@@ -33,9 +33,13 @@ abstract class ArcanistRepositoryAPI {
   const FLAG_UNCOMMITTED  = 128;
   const FLAG_EXTERNALS    = 256;
 
-  // Occurs in SVN when you replace a file with a directory.
+  // Occurs in SVN when you replace a file with a directory without telling
+  // SVN about it.
   const FLAG_OBSTRUCTED   = 512;
 
+  // Occurs in SVN when an update was interrupted or failed, e.g. you ^C'd it.
+  const FLAG_INCOMPLETE   = 1024;
+
   protected $path;
   protected $diffLinesOfContext = 0x7FFF;
 
@@ -110,6 +114,10 @@ abstract class ArcanistRepositoryAPI {
     return $this->getWorkingCopyFilesWithMask(self::FLAG_CONFLICT);
   }
 
+  public function getIncompleteChanges() {
+    return $this->getWorkingCopyFilesWithMask(self::FLAG_INCOMPLETE);
+  }
+
   private function getWorkingCopyFilesWithMask($mask) {
     $match = array();
     foreach ($this->getWorkingCopyStatus() as $file => $flags) {
index 5edfbc199b95ceeced2aaa2df9c53e39513df1ec..e8dd6bb15253d1a440a652d7a56014e08cbd3dd6 100644 (file)
@@ -125,6 +125,9 @@ class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
           case 'conflicted':
             $mask |= self::FLAG_CONFLICT;
             break;
+          case 'incomplete':
+            $mask |= self::FLAG_INCOMPLETE;
+            break;
           default:
             throw new Exception("Unrecognized item status '{$item}'.");
         }
index 8772422bb9e4605b134fd59940f981ca52f1d42d..c66c300a1c0e7a46ccc50bb47b9dc7e048645065 100644 (file)
@@ -319,14 +319,36 @@ class ArcanistBaseWorkflow {
     $untracked = $api->getUntrackedChanges();
     if ($this->shouldRequireCleanUntrackedFiles()) {
       if (!empty($untracked)) {
-        throw new ArcanistUsageException(
-          "You have untracked files in this working copy:\n".
-          "    ".implode("\n    ", $untracked)."\n\n".
-          "Add or delete them before proceeding, or include them in your ".
-          "ignore rules. To bypass this check, use --allow-untracked.");
+
+        echo "You have untracked files in this working copy:\n\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 ".
+            "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 ".
+            "have forgotten to 'svn add' them.");
+        }
+
+        $prompt = "Do you want to continue without adding these files?";
+        if (!phutil_console_confirm($prompt, $default_no = false)) {
+          throw new ArcanistUserAbortException();
+        }
       }
     }
 
+    $incomplete = $api->getIncompleteChanges();
+    if ($incomplete) {
+      throw new ArcanistUsageException(
+        "You have incompletely checked out directories in this working copy. ".
+        "Fix them before proceeding: \n\n".
+        "    ".implode("\n    ", $incomplete)."\n\n".
+        "You can fix these paths by running 'svn update' on them.");
+    }
 
     if ($api->getMergeConflicts()) {
       throw new ArcanistUsageException(
index 5be4f028f428d8fead3cd98102c69f17e4bed5d6..b9fb5a2f5ecc7d4ca3300f2e6c26f34d05d9ef7d 100644 (file)
@@ -9,6 +9,7 @@
 phutil_require_module('arcanist', 'differential/revision');
 phutil_require_module('arcanist', 'exception');
 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');
 phutil_require_module('arcanist', 'parser/diff/change');
index e91d18477b40ca7591f435c86314d83fb47bfd49..fdf27f936e87050bc2e02bcfef0cba9aafd97829 100644 (file)
@@ -203,6 +203,14 @@ EOTEXT
 
     $paths = $this->generateAffectedPaths();
 
+    // Do this before we start linting or running unit tests so we can detect
+    // things like a missing test plan or invalid reviewers immediately.
+    if ($this->shouldOnlyCreateDiff()) {
+      $commit_message = null;
+    } else {
+      $commit_message = $this->getGitCommitMessage();
+    }
+
     $lint_result = $this->runLint($paths);
     $unit_result = $this->runUnit($paths);
 
@@ -322,7 +330,7 @@ EOTEXT
         "        **Diff URI:** __%s__\n\n",
         $diff_info['uri']);
     } else {
-      $message = $this->getGitCommitMessage();
+      $message = $commit_message;
 
       $revision = array(
         'diffid' => $diff_info['diffid'],
@@ -353,6 +361,15 @@ EOTEXT
         }
 
         $should_edit = $this->getArgument('edit');
+
+/*
+
+  TODO: This is a complicated mess. We need to move to storing a checksum
+  of the non-auto-sync fields as they existed at original diff time and using
+  changes from that to detect user edits, not comparison of the client and
+  server values since they diverge without user edits (because of Herald
+  and explicit server-side user changes).
+
         if (!$should_edit) {
           $local_sum = $message->getChecksum();
           $remote_sum = $remote_message->getChecksum();
@@ -366,6 +383,7 @@ EOTEXT
               $default_no = false);
           }
         }
+*/
 
         $revision['fields'] = $remote_message->getFields();