1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Allow diffusion to load initial commits in Mercurial repositories

Summary: no parents - no problem - just diff that ish against "null"

Test Plan: initial commits were viewable in my test repos

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1689

Differential Revision: https://secure.phabricator.com/D3660
This commit is contained in:
Bob Trahan 2012-10-08 16:35:34 -07:00
parent cbde56cdce
commit 6bbdd2609a

View file

@ -19,6 +19,27 @@
final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery { final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery {
protected function executeQuery() { protected function executeQuery() {
$raw_diff = $this->executeRawDiffCommand();
// the only legitimate case here is if we are looking at the first commit
// in the repository. no parents means first commit.
if (!$raw_diff) {
$drequest = $this->getRequest();
$parent_query =
DiffusionCommitParentsQuery::newFromDiffusionRequest($drequest);
$parents = $parent_query->loadParents();
if ($parents === array()) {
// mercurial likes the string null here
$this->setAgainstCommit('null');
$raw_diff = $this->executeRawDiffCommand();
}
}
return $raw_diff;
}
protected function executeRawDiffCommand() {
$drequest = $this->getRequest(); $drequest = $this->getRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();