From ac62f28f1910222fff2f5fbd2599b742f37294eb Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 Aug 2014 11:25:27 -0700 Subject: [PATCH] Schedule repository updates from `arc commit`, not just `arc land` 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 | 2 ++ src/workflow/ArcanistLandWorkflow.php | 18 +-------------- src/workflow/ArcanistWorkflow.php | 30 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/workflow/ArcanistCommitWorkflow.php b/src/workflow/ArcanistCommitWorkflow.php index 0e3d5530..840cc261 100644 --- a/src/workflow/ArcanistCommitWorkflow.php +++ b/src/workflow/ArcanistCommitWorkflow.php @@ -160,6 +160,8 @@ EOTEXT throw new Exception("Executing 'svn commit' failed!"); } + $this->askForRepositoryUpdate(); + $mark_workflow = $this->buildChildWorkflow( 'close-revision', array( diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php index f69edc27..16140a10 100644 --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -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', diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php index 8e7cc701..e8a20e58 100644 --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -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. + } + } + } + + }