Skip to content

Commit cc66c48

Browse files
author
epriestley
committed
Commit + Herald integration.
1 parent 06ae6e4 commit cc66c48

12 files changed

+33
-18
lines changed

scripts/__init_env__.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
phutil_require_module('phabricator', 'infrastructure/env');
3434
PhabricatorEnv::setEnvConfig($conf);
3535

36+
phutil_load_library('arcanist/src');
3637

3738
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) {
3839
phutil_load_library($library);

scripts/__init_script__.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,3 @@
2626
}
2727

2828
phutil_load_library(dirname(__FILE__).'/../src/');
29-
30-
phutil_require_module('phutil', 'symbols');
31-
32-
function __autoload($class) {
33-
PhutilSymbolLoader::loadClass($class);
34-
}

scripts/repository/parse_one_commit.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
require_once $root.'/scripts/__init_env__.php';
2323

2424
if (empty($argv[1])) {
25-
echo "usage: parse_one_commit.php <commit_name>\n";
25+
echo "usage: parse_one_commit.php <commit_name> [--herald]\n";
2626
die(1);
2727
}
2828

@@ -72,6 +72,10 @@
7272
throw new Exception("Unknown repository type!");
7373
}
7474

75+
if (isset($argv[2]) && $argv[2] == '--herald') {
76+
$workers[] = new PhabricatorRepositoryCommitHeraldWorker($spec);
77+
}
78+
7579
ExecFuture::pushEchoMode(true);
7680

7781
foreach ($workers as $worker) {

src/applications/herald/adapter/commit/HeraldCommitAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getPHID() {
4646
}
4747

4848
public function getEmailPHIDs() {
49-
return $this->emailPHIDs;
49+
return array_keys($this->emailPHIDs);
5050
}
5151

5252
public function getHeraldName() {
@@ -195,7 +195,7 @@ public function applyHeraldEffects(array $effects) {
195195
break;
196196
case HeraldActionConfig::ACTION_EMAIL:
197197
foreach ($effect->getTarget() as $fbid) {
198-
$this->emailPHIDs[] = $fbid;
198+
$this->emailPHIDs[$fbid] = true;
199199
}
200200
$result[] = new HeraldApplyTranscript(
201201
$effect,

src/applications/metamta/controller/send/PhabricatorMetaMTASendController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public function processRequest() {
3333
$mail->setSimulatedFailureCount($request->getInt('failures'));
3434
$mail->setIsHTML($request->getInt('html'));
3535
$mail->save();
36-
if ($request->getInt('immediately')) {
36+
if ($request->getInt('immediately') &&
37+
!PhabricatorEnv::getEnvConfig('metamta.send-immediately')) {
3738
$mail->sendNow($force_send = true);
3839
}
3940

src/applications/metamta/controller/send/__init__.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
phutil_require_module('phabricator', 'aphront/response/redirect');
1010
phutil_require_module('phabricator', 'applications/metamta/controller/base');
1111
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
12+
phutil_require_module('phabricator', 'infrastructure/env');
1213
phutil_require_module('phabricator', 'view/form/base');
1314
phutil_require_module('phabricator', 'view/form/control/submit');
1415
phutil_require_module('phabricator', 'view/layout/panel');

src/applications/repository/worker/commitchangeparser/base/PhabricatorRepositoryCommitChangeParserWorker.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,17 @@ private function lookupPaths(array $paths) {
7171
return $result_map;
7272
}
7373

74+
protected function finishParse() {
75+
$commit = $this->commit;
76+
if ($this->shouldQueueFollowupTasks()) {
77+
$task = new PhabricatorWorkerTask();
78+
$task->setTaskClass('PhabricatorRepositoryCommitHeraldWorker');
79+
$task->setData(
80+
array(
81+
'commitID' => $commit->getID(),
82+
));
83+
$task->save();
84+
}
85+
}
7486

7587
}

src/applications/repository/worker/commitchangeparser/base/__init__.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
phutil_require_module('phabricator', 'applications/repository/storage/repository');
1010
phutil_require_module('phabricator', 'applications/repository/worker/base');
11+
phutil_require_module('phabricator', 'infrastructure/daemon/workers/storage/task');
1112
phutil_require_module('phabricator', 'storage/qsprintf');
1213
phutil_require_module('phabricator', 'storage/queryfx');
1314

src/applications/repository/worker/commitchangeparser/git/PhabricatorRepositoryGitCommitChangeParserWorker.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ protected function parseCommit(
244244
PhabricatorRepository::TABLE_PATHCHANGE,
245245
implode(', ', $sql_chunk));
246246
}
247+
248+
$this->finishParse();
247249
}
248250

249251
}

src/applications/repository/worker/commitchangeparser/svn/PhabricatorRepositorySvnCommitChangeParserWorker.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ protected function parseCommit(
366366

367367
$this->writeChanges($repository, $commit, $effects, $path_map, $commit_map);
368368
$this->writeBrowse($repository, $commit, $effects, $path_map);
369+
370+
$this->finishParse();
369371
}
370372

371373
private function writeChanges(

0 commit comments

Comments
 (0)