Differential D16460 Diff 39599 src/applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php
| <?php | <?php | ||||
| final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery { | final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery { | ||||
| protected function executeQuery() { | protected function newQueryFuture() { | ||||
| return $this->executeRawDiffCommand(); | |||||
| } | |||||
| protected function executeRawDiffCommand() { | |||||
| $drequest = $this->getRequest(); | $drequest = $this->getRequest(); | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $commit = $this->getAnchorCommit(); | $commit = $this->getAnchorCommit(); | ||||
| // If there's no path, get the entire raw diff. | // If there's no path, get the entire raw diff. | ||||
| $path = nonempty($drequest->getPath(), '.'); | $path = nonempty($drequest->getPath(), '.'); | ||||
| $against = $this->getAgainstCommit(); | $against = $this->getAgainstCommit(); | ||||
| if ($against === null) { | if ($against === null) { | ||||
| // If `$commit` has no parents (usually because it's the first commit | // If `$commit` has no parents (usually because it's the first commit | ||||
| // in the repository), we want to diff against `null`. This revset will | // in the repository), we want to diff against `null`. This revset will | ||||
| // do that for us automatically. | // do that for us automatically. | ||||
| $against = '('.$commit.'^ or null)'; | $against = '('.$commit.'^ or null)'; | ||||
| } | } | ||||
| $future = $repository->getLocalCommandFuture( | $future = $repository->getLocalCommandFuture( | ||||
| 'diff -U %d --git --rev %s --rev %s -- %s', | 'diff -U %d --git --rev %s --rev %s -- %s', | ||||
| $this->getLinesOfContext(), | $this->getLinesOfContext(), | ||||
| $against, | $against, | ||||
| $commit, | $commit, | ||||
| $path); | $path); | ||||
| $this->configureFuture($future); | return $future; | ||||
| list($raw_diff) = $future->resolvex(); | |||||
| return $raw_diff; | |||||
| } | } | ||||
| } | } | ||||