1
0
Fork 0
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:
epriestley 2011-04-02 17:11:51 -07:00
parent 8f5d01d451
commit 1b2140d7a4
6 changed files with 49 additions and 10 deletions

View file

@ -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');

View file

@ -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();
}
}

View file

@ -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');

View file

@ -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();

View file

@ -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();

View file

@ -140,6 +140,11 @@ class DiffusionRequest {
return $this->commit;
}
public function setCommit($commit) {
$this->commit = $commit;
return $this;
}
public function getCommitURIComponent($commit) {
return $commit;
}