1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Reintegrate Herald with Differential.

This commit is contained in:
epriestley 2011-04-07 18:55:43 -07:00
parent 5e9d053f8e
commit 68687a059a
3 changed files with 19 additions and 35 deletions

View file

@ -188,36 +188,24 @@ class DifferentialRevisionEditor {
$diff->setRevisionID($revision->getID());
$revision->setLineCount($diff->getLineCount());
// TODO!
// $revision->setRepositoryID($diff->getRepositoryID());
$adapter = new HeraldDifferentialRevisionAdapter(
$revision,
$diff);
$adapter->setExplicitCCs($new['ccs']);
$adapter->setExplicitReviewers($new['rev']);
$adapter->setForbiddenCCs($revision->getUnsubscribed());
/*
$iface = new DifferentialRevisionHeraldable($revision);
$iface->setExplicitCCs($new['ccs']);
$iface->setExplicitReviewers($new['rev']);
$iface->setForbiddenCCs($revision->getForbiddenCCPHIDs());
$iface->setForbiddenReviewers($revision->getForbiddenReviewers());
$iface->setDiff($diff);
$xscript = HeraldEngine::loadAndApplyRules($iface);
$xscript_uri = $xscript->getURI();
$xscript = HeraldEngine::loadAndApplyRules($adapter);
$xscript_uri = PhabricatorEnv::getProductionURI(
'/herald/transcript/'.$xscript->getID().'/');
$xscript_phid = $xscript->getPHID();
$xscript_header = $xscript->getXHeraldRulesHeader();
$sub = array(
'rev' => array(),
'ccs' => $iface->getCCsAddedByHerald(),
'ccs' => $adapter->getCCsAddedByHerald(),
);
$rem_ccs = $iface->getCCsRemovedByHerald();
*/
// TODO!
$sub = array(
'rev' => array(),
'ccs' => array(),
);
$rem_ccs = $adapter->getCCsRemovedByHerald();
} else {
$sub = array(
'rev' => array(),
@ -260,6 +248,8 @@ class DifferentialRevisionEditor {
// TODO: When Herald is brought over, run through this stuff to figure
// out which adds are Herald's fault.
// TODO: Still need to do this.
if ($add['ccs'] || $rem['ccs']) {
foreach (array_keys($add['ccs']) as $id) {
if (empty($new['ccs'][$id])) {
@ -358,10 +348,8 @@ class DifferentialRevisionEditor {
'actor' => $this->getActorPHID(),
);
// TODO: When timelines get implemented, move indexing to them.
// TODO: Move this into a worker task thing.
PhabricatorSearchDifferentialIndexer::indexRevision($revision);
// TODO
// id(new ToolsTimelineEvent('difx', fb_json_encode($event)))->record();
if ($this->silentUpdate) {
return;
@ -407,9 +395,8 @@ class DifferentialRevisionEditor {
}
foreach ($mail as $message) {
// TODO
// $message->setHeraldTranscriptURI($xscript_uri);
// $message->setXHeraldRulesHeader($xscript_header);
$message->setHeraldTranscriptURI($xscript_uri);
$message->setXHeraldRulesHeader($xscript_header);
$message->send();
}
}

View file

@ -11,8 +11,11 @@ phutil_require_module('phabricator', 'applications/differential/mail/ccwelcome')
phutil_require_module('phabricator', 'applications/differential/mail/newdiff');
phutil_require_module('phabricator', 'applications/differential/storage/comment');
phutil_require_module('phabricator', 'applications/differential/storage/revision');
phutil_require_module('phabricator', 'applications/herald/adapter/differential');
phutil_require_module('phabricator', 'applications/herald/engine/engine');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'applications/search/index/indexer/differential');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'storage/qsprintf');
phutil_require_module('phabricator', 'storage/queryfx');

View file

@ -24,7 +24,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
protected $explicitCCs;
protected $explicitReviewers;
protected $forbiddenCCs;
protected $forbiddenReviewers;
protected $newCCs = array();
protected $remCCs = array();
@ -57,11 +56,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
return $this;
}
public function setForbiddenReviewers($forbidden_reviewers) {
$this->forbiddenReviewers = $forbidden_reviewers;
return $this;
}
public function getCCsAddedByHerald() {
return array_diff_key($this->newCCs, $this->remCCs);
}