From 1f7e9bcadd75a28c5963a25c6f1c5143fbd71bf3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 21 Jan 2013 07:45:42 -0800 Subject: [PATCH] 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 --- .../controller/DiffusionCommitController.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 1f81f013d7..72ba662840 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -52,6 +52,7 @@ final class DiffusionCommitController extends DiffusionController { ->setNavigationMarker(true); $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); + $changesets = null; if ($is_foreign) { $subpath = $commit_data->getCommitDetail('svn-subpath'); @@ -319,22 +320,26 @@ final class DiffusionCommitController extends DiffusionController { $repository, $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( '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( - $nav, + $content, array( 'title' => $commit_id )