]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Schedule repository updates from `arc commit`, not just `arc land`
authorepriestley <git@epriestley.com>
Thu, 21 Aug 2014 18:25:27 +0000 (11:25 -0700)
committerepriestley <git@epriestley.com>
Thu, 21 Aug 2014 18:25:27 +0000 (11:25 -0700)
Summary: Ref T5926. We only pass Phabricator an update hint from `arc land`, not from `arc commit`.

Test Plan:
  - Ran `arc land` and `arc commit` with `--trace`, saw hints go over the wire.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5926

Differential Revision: https://secure.phabricator.com/D10324

src/workflow/ArcanistCommitWorkflow.php
src/workflow/ArcanistLandWorkflow.php
src/workflow/ArcanistWorkflow.php

index 0e3d55307386e3181158902a427dcdd81a97956a..840cc2615e38e8174bd88fce5b754f8987861799 100644 (file)
@@ -160,6 +160,8 @@ EOTEXT
       throw new Exception("Executing 'svn commit' failed!");
     }
 
+    $this->askForRepositoryUpdate();
+
     $mark_workflow = $this->buildChildWorkflow(
       'close-revision',
       array(
index f69edc27b1e5a6228cd145f5db03764d18c2f421..16140a106d10ee3ccf924ce9fc308373a12ad4b0 100644 (file)
@@ -1035,23 +1035,7 @@ EOTEXT
           $cmd));
       }
 
-      // If we know which repository we're in, try to tell Phabricator that we
-      // pushed commits to it so it can update. This hint can help pull updates
-      // more quickly, especially in rarely-used repositories.
-      if ($this->getRepositoryCallsign()) {
-        try {
-          $this->getConduit()->callMethodSynchronous(
-            'diffusion.looksoon',
-            array(
-              'callsigns' => array($this->getRepositoryCallsign()),
-            ));
-        } catch (ConduitClientException $ex) {
-          // If we hit an exception, just ignore it. Likely, we are running
-          // against a Phabricator which is too old to support this method.
-          // Since this hint is purely advisory, it doesn't matter if it has
-          // no effect.
-        }
-      }
+      $this->askForRepositoryUpdate();
 
       $mark_workflow = $this->buildChildWorkflow(
         'close-revision',
index 8e7cc701620ecaf0eaf331c2e21a17825b4f142c..e8a20e587a00f557d6da52dc8061a4987c4e5ed6 100644 (file)
@@ -1839,4 +1839,34 @@ abstract class ArcanistWorkflow extends Phobject {
         "Arcanist config to specify a command to use."));
   }
 
+
+  /**
+   * Ask Phabricator to update the current repository as soon as possible.
+   *
+   * Calling this method after pushing commits allows Phabricator to discover
+   * the commits more quickly, so the system overall is more responsive.
+   *
+   * @return void
+   */
+  protected function askForRepositoryUpdate() {
+    // If we know which repository we're in, try to tell Phabricator that we
+    // pushed commits to it so it can update. This hint can help pull updates
+    // more quickly, especially in rarely-used repositories.
+    if ($this->getRepositoryCallsign()) {
+      try {
+        $this->getConduit()->callMethodSynchronous(
+          'diffusion.looksoon',
+          array(
+            'callsigns' => array($this->getRepositoryCallsign()),
+          ));
+      } catch (ConduitClientException $ex) {
+        // If we hit an exception, just ignore it. Likely, we are running
+        // against a Phabricator which is too old to support this method.
+        // Since this hint is purely advisory, it doesn't matter if it has
+        // no effect.
+      }
+    }
+  }
+
+
 }