@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<?php
2
3final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery {
4
5 protected function newQueryFuture() {
6 $drequest = $this->getRequest();
7 $repository = $drequest->getRepository();
8
9 $commit = $this->getAnchorCommit();
10
11 // If there's no path, get the entire raw diff.
12 $path = nonempty($drequest->getPath(), '.');
13
14 $against = $this->getAgainstCommit();
15 if ($against === null) {
16 // If `$commit` has no parents (usually because it's the first commit
17 // in the repository), we want to diff against `null`. This revset will
18 // do that for us automatically.
19 $against = hgsprintf('(%s^ or null)', $commit);
20 }
21
22 $future = $repository->getLocalCommandFuture(
23 'diff -U %d --git --rev %s --rev %s -- %s',
24 $this->getLinesOfContext(),
25 $against,
26 hgsprintf('%s', $commit),
27 $path);
28
29 return $future;
30 }
31
32}