Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php
12242 views
1
<?php
2
3
final 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
}
33
34