mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +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:
parent
94445d41e7
commit
0cfdf2f74f
4 changed files with 31 additions and 4 deletions
|
@ -35,13 +35,18 @@ final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery {
|
||||||
);
|
);
|
||||||
$options = implode(' ', $options);
|
$options = implode(' ', $options);
|
||||||
|
|
||||||
|
$against = $this->getAgainstCommit();
|
||||||
|
if ($against === null) {
|
||||||
|
$against = $commit.'^';
|
||||||
|
}
|
||||||
|
|
||||||
// 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(), '.');
|
||||||
|
|
||||||
$future = $repository->getLocalCommandFuture(
|
$future = $repository->getLocalCommandFuture(
|
||||||
"diff %C %s^ %s -- %s",
|
"diff %C %s %s -- %s",
|
||||||
$options,
|
$options,
|
||||||
$commit,
|
$against,
|
||||||
$commit,
|
$commit,
|
||||||
$path);
|
$path);
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,15 @@ final class DiffusionMercurialRawDiffQuery extends DiffusionRawDiffQuery {
|
||||||
// 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();
|
||||||
|
if ($against === null) {
|
||||||
|
$against = $commit.'^';
|
||||||
|
}
|
||||||
|
|
||||||
$future = $repository->getLocalCommandFuture(
|
$future = $repository->getLocalCommandFuture(
|
||||||
'diff -U %d --git --change %s -- %s',
|
'diff -U %d --git --rev %s:%s -- %s',
|
||||||
$this->getLinesOfContext(),
|
$this->getLinesOfContext(),
|
||||||
|
$against,
|
||||||
$commit,
|
$commit,
|
||||||
$path);
|
$path);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ abstract class DiffusionRawDiffQuery extends DiffusionQuery {
|
||||||
private $request;
|
private $request;
|
||||||
private $timeout;
|
private $timeout;
|
||||||
private $linesOfContext = 65535;
|
private $linesOfContext = 65535;
|
||||||
|
private $againstCommit;
|
||||||
|
|
||||||
final public static function newFromDiffusionRequest(
|
final public static function newFromDiffusionRequest(
|
||||||
DiffusionRequest $request) {
|
DiffusionRequest $request) {
|
||||||
|
@ -49,4 +50,13 @@ abstract class DiffusionRawDiffQuery extends DiffusionQuery {
|
||||||
return $this->linesOfContext;
|
return $this->linesOfContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function setAgainstCommit($value) {
|
||||||
|
$this->againstCommit = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function getAgainstCommit() {
|
||||||
|
return $this->againstCommit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,16 @@ final class DiffusionSvnRawDiffQuery extends DiffusionRawDiffQuery {
|
||||||
$commit = $drequest->getCommit();
|
$commit = $drequest->getCommit();
|
||||||
$arc_root = phutil_get_library_root('arcanist');
|
$arc_root = phutil_get_library_root('arcanist');
|
||||||
|
|
||||||
|
$against = $this->getAgainstCommit();
|
||||||
|
if ($against === null) {
|
||||||
|
$against = $commit - 1;
|
||||||
|
}
|
||||||
|
|
||||||
$future = $repository->getRemoteCommandFuture(
|
$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',
|
$arc_root.'/../scripts/repository/binary_safe_diff.sh',
|
||||||
$this->getLinesOfContext(),
|
$this->getLinesOfContext(),
|
||||||
|
$against,
|
||||||
$commit,
|
$commit,
|
||||||
$repository->getRemoteURI(),
|
$repository->getRemoteURI(),
|
||||||
$drequest->getPath());
|
$drequest->getPath());
|
||||||
|
|
Loading…
Reference in a new issue