1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Allow specifying against commit in DiffusionRawDiffQuery

Summary: I will need this for tracking line number in Blame previous revision.

Test Plan:
  $ hg diff --rev 0:1
  $ svn diff -r 64382:64383 README

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3083
This commit is contained in:
vrana 2012-07-26 15:00:24 -07:00
parent 94445d41e7
commit 0cfdf2f74f
4 changed files with 31 additions and 4 deletions

View file

@ -35,13 +35,18 @@ final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery {
);
$options = implode(' ', $options);
$against = $this->getAgainstCommit();
if ($against === null) {
$against = $commit.'^';
}
// If there's no path, get the entire raw diff.
$path = nonempty($drequest->getPath(), '.');
$future = $repository->getLocalCommandFuture(
"diff %C %s^ %s -- %s",
"diff %C %s %s -- %s",
$options,
$commit,
$against,
$commit,
$path);

View file

@ -27,9 +27,15 @@ final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery {
// If there's no path, get the entire raw diff.
$path = nonempty($drequest->getPath(), '.');
$against = $this->getAgainstCommit();
if ($against === null) {
$against = $commit.'^';
}
$future = $repository->getLocalCommandFuture(
'diff -U %d --git --change %s -- %s',
'diff -U %d --git --rev %s:%s -- %s',
$this->getLinesOfContext(),
$against,
$commit,
$path);

View file

@ -21,6 +21,7 @@ abstract class DiffusionRawDiffQuery extends DiffusionQuery {
private $request;
private $timeout;
private $linesOfContext = 65535;
private $againstCommit;
final public static function newFromDiffusionRequest(
DiffusionRequest $request) {
@ -49,4 +50,13 @@ abstract class DiffusionRawDiffQuery extends DiffusionQuery {
return $this->linesOfContext;
}
final public function setAgainstCommit($value) {
$this->againstCommit = $value;
return $this;
}
final public function getAgainstCommit() {
return $this->againstCommit;
}
}

View file

@ -25,10 +25,16 @@ final class DiffusionSvnRawDiffQuery extends DiffusionRawDiffQuery {
$commit = $drequest->getCommit();
$arc_root = phutil_get_library_root('arcanist');
$against = $this->getAgainstCommit();
if ($against === null) {
$against = $commit - 1;
}
$future = $repository->getRemoteCommandFuture(
'diff --diff-cmd %s -x -U%d -c %d %s%s@',
'diff --diff-cmd %s -x -U%d -r %d:%d %s%s@',
$arc_root.'/../scripts/repository/binary_safe_diff.sh',
$this->getLinesOfContext(),
$against,
$commit,
$repository->getRemoteURI(),
$drequest->getPath());