1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 00:49:11 +02:00

Dispatch a "diff.willBuildMessage" event from Arcanist

Summary:
Hive has custom integration which relies on prefilling a bunch of information from JIRA. This is currently broken and accomplished in a roundabout way. Instead, add an event that the integration can listen for. See next diff.

@Girish, I guess you're official Phabricator/Hive support now?

Test Plan: Ran the Hive/JIRA workflows in Git and SVN, see next diff.

Reviewers: Girish, btrahan, ashutoshc

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1206

Differential Revision: https://secure.phabricator.com/D2449
This commit is contained in:
epriestley 2012-05-20 16:39:38 -07:00
parent d23d2df7e1
commit 3e655e7d4c
3 changed files with 24 additions and 6 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@
final class ArcanistEventType extends PhutilEventType {
const TYPE_COMMIT_WILLCOMMITSVN = 'commit.willCommitSVN';
const TYPE_COMMIT_WILLCOMMITSVN = 'commit.willCommitSVN';
const TYPE_DIFF_WILLBUILDMESSAGE = 'diff.willBuildMessage';
}

View file

@ -1633,20 +1633,22 @@ EOTEXT
}
private function getDefaultCreateFields() {
$empty = array(array(), array(), array());
$result = array(array(), array(), array());
if ($this->isRawDiffSource()) {
return $empty;
return $result;
}
$repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistGitAPI) {
return $this->getGitCreateFields();
$result = $this->getGitCreateFields();
}
// TODO: Load default fields in Mercurial.
return $empty;
$result[0] = $this->dispatchWillBuildEvent($result[0]);
return $result;
}
private function getGitCreateFields() {
@ -2038,4 +2040,16 @@ EOTEXT
));
}
private function dispatchWillBuildEvent(array $fields) {
$event = new PhutilEvent(
ArcanistEventType::TYPE_DIFF_WILLBUILDMESSAGE,
array(
'fields' => $fields,
));
PhutilEventEngine::dispatchEvent($event);
return $event->getValue('fields');
}
}

View file

@ -8,6 +8,7 @@
phutil_require_module('arcanist', 'difference');
phutil_require_module('arcanist', 'differential/commitmessage');
phutil_require_module('arcanist', 'events/constant/type');
phutil_require_module('arcanist', 'exception/usage');
phutil_require_module('arcanist', 'exception/usage/userabort');
phutil_require_module('arcanist', 'parser/commentremover');
@ -21,6 +22,8 @@ phutil_require_module('arcanist', 'workflow/unit');
phutil_require_module('phutil', 'console');
phutil_require_module('phutil', 'console/editor');
phutil_require_module('phutil', 'events/engine');
phutil_require_module('phutil', 'events/event');
phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'filesystem/filelist');
phutil_require_module('phutil', 'filesystem/tempfile');