1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 22:10:54 +01:00

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
This commit is contained in:
epriestley 2014-08-21 11:25:27 -07:00
parent 65b6e1bdac
commit ac62f28f19
3 changed files with 33 additions and 17 deletions

View file

@ -160,6 +160,8 @@ EOTEXT
throw new Exception("Executing 'svn commit' failed!");
}
$this->askForRepositoryUpdate();
$mark_workflow = $this->buildChildWorkflow(
'close-revision',
array(

View 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',

View 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.
}
}
}
}