mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
Unmuck some issues with viewing HEAD changes.
This commit is contained in:
parent
8f5d01d451
commit
1b2140d7a4
6 changed files with 49 additions and 10 deletions
|
@ -23,14 +23,6 @@ class DiffusionChangeController extends DiffusionController {
|
|||
|
||||
$content = array();
|
||||
|
||||
$content[] = $this->buildCrumbs(
|
||||
array(
|
||||
'branch' => true,
|
||||
'path' => true,
|
||||
'view' => 'change',
|
||||
));
|
||||
|
||||
|
||||
$diff_query = DiffusionDiffQuery::newFromDiffusionRequest($drequest);
|
||||
$changeset = $diff_query->loadChangeset();
|
||||
|
||||
|
@ -39,6 +31,13 @@ class DiffusionChangeController extends DiffusionController {
|
|||
$changeset_view->setRenderURI(
|
||||
'/diffusion/'.$drequest->getRepository()->getCallsign().'/diff/');
|
||||
|
||||
$content[] = $this->buildCrumbs(
|
||||
array(
|
||||
'branch' => true,
|
||||
'path' => true,
|
||||
'view' => 'change',
|
||||
));
|
||||
|
||||
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
||||
// Differential better.
|
||||
require_celerity_resource('differential-core-view-css');
|
||||
|
|
|
@ -57,4 +57,18 @@ abstract class DiffusionDiffQuery {
|
|||
}
|
||||
|
||||
abstract protected function executeQuery();
|
||||
|
||||
protected function getEffectiveCommit() {
|
||||
$drequest = $this->getRequest();
|
||||
|
||||
$modified_query = DiffusionLastModifiedQuery::newFromDiffusionRequest(
|
||||
$drequest);
|
||||
list($commit) = $modified_query->loadLastModification();
|
||||
if (!$commit) {
|
||||
// TODO: Improve error messages here.
|
||||
return null;
|
||||
}
|
||||
return $commit->getCommitIdentifier();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
|
||||
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
|
||||
|
||||
phutil_require_module('phutil', 'symbols');
|
||||
|
|
|
@ -22,6 +22,17 @@ final class DiffusionGitDiffQuery extends DiffusionDiffQuery {
|
|||
$drequest = $this->getRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
if (!$drequest->getRawCommit()) {
|
||||
$effective_commit = $this->getEffectiveCommit();
|
||||
if (!$effective_commit) {
|
||||
return null;
|
||||
}
|
||||
// TODO: This side effect is kind of skethcy.
|
||||
$drequest->setCommit($effective_commit);
|
||||
} else {
|
||||
$effective_commit = $drequest->getCommit();
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'-M',
|
||||
'-C',
|
||||
|
@ -36,8 +47,8 @@ final class DiffusionGitDiffQuery extends DiffusionDiffQuery {
|
|||
list($raw_diff) = execx(
|
||||
"(cd %s && git diff {$options} %s^ %s -- %s)",
|
||||
$repository->getDetail('local-path'),
|
||||
$drequest->getCommit(),
|
||||
$drequest->getCommit(),
|
||||
$effective_commit,
|
||||
$effective_commit,
|
||||
$drequest->getPath());
|
||||
|
||||
$parser = new ArcanistDiffParser();
|
||||
|
|
|
@ -21,6 +21,15 @@ final class DiffusionSvnDiffQuery extends DiffusionDiffQuery {
|
|||
protected function executeQuery() {
|
||||
$drequest = $this->getRequest();
|
||||
|
||||
if (!$drequest->getRawCommit()) {
|
||||
$effective_commit = $this->getEffectiveCommit();
|
||||
if (!$effective_commit) {
|
||||
return null;
|
||||
}
|
||||
// TODO: Sketchy side effect.
|
||||
$drequest->setCommit($effective_commit);
|
||||
}
|
||||
|
||||
$path_change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
|
||||
$drequest);
|
||||
$path_changes = $path_change_query->loadChanges();
|
||||
|
|
|
@ -140,6 +140,11 @@ class DiffusionRequest {
|
|||
return $this->commit;
|
||||
}
|
||||
|
||||
public function setCommit($commit) {
|
||||
$this->commit = $commit;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommitURIComponent($commit) {
|
||||
return $commit;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue