1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Don't throw an exception for partially imported commits

Summary: Fixes T2243. We recently added the FileTreeView to Diffusion commits. However, if the page doesn't have any changesets (e.g., it has an error message instead, like "this commit hasn't imported yet"), we fail to build a file tree. In this case, don't try to build one.

Test Plan: Looked at not-imported and imported commits in Diffusion, saw proper rendering/crumbs and no exceptions.

Reviewers: btrahan, chad, vrana

Reviewed By: chad

CC: aran

Maniphest Tasks: T2243

Differential Revision: https://secure.phabricator.com/D4562
This commit is contained in:
epriestley 2013-01-21 07:45:42 -08:00
parent 660022665b
commit 1f7e9bcadd

View file

@ -52,6 +52,7 @@ final class DiffusionCommitController extends DiffusionController {
->setNavigationMarker(true); ->setNavigationMarker(true);
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
$changesets = null;
if ($is_foreign) { if ($is_foreign) {
$subpath = $commit_data->getCommitDetail('svn-subpath'); $subpath = $commit_data->getCommitDetail('svn-subpath');
@ -319,22 +320,26 @@ final class DiffusionCommitController extends DiffusionController {
$repository, $repository,
$commit->getCommitIdentifier() $commit->getCommitIdentifier()
); );
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setAnchorName('top')
->setTitle($short_name)
->setBaseURI(new PhutilURI('/'.$commit_id))
->build($changesets);
foreach ($content as $child) {
$nav->appendChild($child);
}
$crumbs = $this->buildCrumbs(array( $crumbs = $this->buildCrumbs(array(
'commit' => true, 'commit' => true,
)); ));
$nav->setCrumbs($crumbs);
if ($changesets) {
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setAnchorName('top')
->setTitle($short_name)
->setBaseURI(new PhutilURI('/'.$commit_id))
->build($changesets)
->setCrumbs($crumbs)
->appendChild($content);
$content = $nav;
} else {
$content = array($crumbs, $content);
}
return $this->buildApplicationPage( return $this->buildApplicationPage(
$nav, $content,
array( array(
'title' => $commit_id 'title' => $commit_id
) )