]> khamidou — GitHub mirrors - arcanist.git/commitdiff
If a revision depends on another revision which has not yet been closed, warn the...
authorAfaque Hussain <Afaque.Hussain@outlook.com>
Thu, 7 Mar 2013 16:55:34 +0000 (08:55 -0800)
committerepriestley <git@epriestley.com>
Thu, 7 Mar 2013 17:02:51 +0000 (09:02 -0800)
Summary: Have arc land inspect the revision if it depends on some other revisions which haven't been closed yet. If yes, then warn users.

Test Plan: Will test them locally.

Reviewers: epriestley, AnhNhan

CC: aran, Korvin, AnhNhan
Differential Revision: https://secure.phabricator.com/D5262

src/workflow/ArcanistLandWorkflow.php

index 0dc6c58dd081c3d711ffcdd8a6a2062fd1ed4a3b..861cec5baf1591e24c9a89064b1f872dbd873f20 100644 (file)
@@ -352,6 +352,7 @@ EOTEXT
     $rev_status = $this->revision['status'];
     $rev_id = $this->revision['id'];
     $rev_title = $this->revision['title'];
+    $rev_auxiliary = idx($this->revision, 'auxiliary', array());
 
     if ($rev_status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
       $ok = phutil_console_confirm(
@@ -362,6 +363,42 @@ EOTEXT
       }
     }
 
+    if ($rev_auxiliary) {
+      $phids = idx($rev_auxiliary, 'phabricator:depends-on', array());
+
+      $dep_on_revs = $this->getConduit()->callMethodSynchronous(
+        'differential.query',
+         array(
+           'phids' => $phids,
+           'status' => 'status-open',
+         ));
+
+      $open_dep_revs = array();
+      foreach ($dep_on_revs as $dep_on_rev) {
+        $dep_on_rev_id = $dep_on_rev['id'];
+        $dep_on_rev_title = $dep_on_rev['title'];
+        $dep_on_rev_status = $dep_on_rev['status'];
+        $open_dep_revs[$dep_on_rev_id] = $dep_on_rev_title;
+      }
+
+      if (!empty($open_dep_revs)) {
+        $open_revs = array();
+        foreach ($open_dep_revs as $id => $title) {
+          $open_revs[] = "    - D".$id.": ".$title;
+        }
+        $open_revs = implode("\n", $open_revs);
+
+        echo "Revision 'D{$rev_id}: {$rev_title}' depends ".
+             "on open revisions:\n\n";
+        echo $open_revs;
+
+        $ok = phutil_console_confirm("Continue anyway?");
+        if (!$ok) {
+          throw new ArcanistUserAbortException();
+        }
+      }
+    }
+
     $message = $this->getConduit()->callMethodSynchronous(
       'differential.getcommitmessage',
       array(