@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix the exception when watching the first commit of a mercurial repo

Summary: Most checks were actually in place, but `ExecFuture` throws a `CommandException` which wasn't taken into account.

Test Plan: look at the first command and no longer saw an exception. Also, other commits worked as well.

Reviewers: richardvanvelzen

Reviewed By: richardvanvelzen

CC: krisbuist, Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7730

+6 -19
+6 -19
src/applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php
··· 3 3 final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery { 4 4 5 5 protected function executeQuery() { 6 - $raw_diff = $this->executeRawDiffCommand(); 7 - 8 - // the only legitimate case here is if we are looking at the first commit 9 - // in the repository. no parents means first commit. 10 - if (!$raw_diff) { 11 - $drequest = $this->getRequest(); 12 - $parent_query = 13 - DiffusionCommitParentsQuery::newFromDiffusionRequest($drequest); 14 - $parents = $parent_query->loadParents(); 15 - if ($parents === array()) { 16 - // mercurial likes the string null here 17 - $this->setAgainstCommit('null'); 18 - $raw_diff = $this->executeRawDiffCommand(); 19 - } 20 - } 21 - 22 - return $raw_diff; 6 + return $this->executeRawDiffCommand(); 23 7 } 24 8 25 9 ··· 34 18 35 19 $against = $this->getAgainstCommit(); 36 20 if ($against === null) { 37 - $against = $commit.'^'; 21 + // If `$commit` has no parents (usually because it's the first commit 22 + // in the repository), we want to diff against `null`. This revset will 23 + // do that for us automatically. 24 + $against = '('.$commit.'^ or null)'; 38 25 } 39 26 40 27 $future = $repository->getLocalCommandFuture( 41 - 'diff -U %d --git --rev %s:%s -- %s', 28 + 'diff -U %d --git --rev %s --rev %s -- %s', 42 29 $this->getLinesOfContext(), 43 30 $against, 44 31 $commit,