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

Support content pre-commit hooks in Mercurial

Summary: Ref T4195. Add Mercurial support to the content hook phase.

Test Plan:
Here are some `commit` push logs for a Mercurial repo:

{F90689}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4195

Differential Revision: https://secure.phabricator.com/D7792
This commit is contained in:
epriestley 2013-12-18 14:19:18 -08:00
parent 5f4df0f3e3
commit d90f44ef20

View file

@ -25,6 +25,7 @@ final class DiffusionCommitHookEngine extends Phobject {
private $remoteProtocol;
private $transactionKey;
private $mercurialHook;
private $mercurialCommits = array();
private $heraldViewerProjects;
@ -578,6 +579,7 @@ final class DiffusionCommitHookEngine extends Phobject {
list($commit_raw) = $futures['commits']->resolvex();
$commit_map = $this->parseMercurialCommits($commit_raw);
$this->mercurialCommits = $commit_map;
list($old_raw) = $futures['old']->resolvex();
$old_refs = $this->parseMercurialHeads($old_raw);
@ -797,8 +799,16 @@ final class DiffusionCommitHookEngine extends Phobject {
}
private function findMercurialContentUpdates(array $ref_updates) {
// TODO: Implement.
return array();
$content_updates = array();
foreach ($this->mercurialCommits as $commit => $branches) {
$content_updates[$commit] = $this->newPushLog()
->setRefType(PhabricatorRepositoryPushLog::REFTYPE_COMMIT)
->setRefNew($commit)
->setChangeFlags(PhabricatorRepositoryPushLog::CHANGEFLAG_ADD);
}
return $content_updates;
}
private function parseMercurialCommits($raw) {