@@ -44,31 +44,47 @@ public function processRequest() {
4444
4545 $ commit_data = $ drequest ->loadCommitData ();
4646
47- $ engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine ();
48-
49- require_celerity_resource ('diffusion-commit-view-css ' );
50- require_celerity_resource ('phabricator-remarkup-css ' );
51-
52- $ property_table = $ this ->renderPropertyTable ($ commit , $ commit_data );
53-
54- $ detail_panel ->appendChild (
55- '<div class="diffusion-commit-view"> ' .
56- '<div class="diffusion-commit-dateline"> ' .
57- 'r ' .$ callsign .$ commit ->getCommitIdentifier ().
58- ' · ' .
59- phabricator_datetime ($ commit ->getEpoch (), $ user ).
60- '</div> ' .
61- '<h1>Revision Detail</h1> ' .
62- '<div class="diffusion-commit-details"> ' .
63- $ property_table .
64- '<hr /> ' .
65- '<div class="diffusion-commit-message phabricator-remarkup"> ' .
66- $ engine ->markupText ($ commit_data ->getCommitMessage ()).
47+ $ is_foreign = $ commit_data ->getCommitDetail ('foreign-svn-stub ' );
48+ if ($ is_foreign ) {
49+ $ subpath = $ commit_data ->getCommitDetail ('svn-subpath ' );
50+
51+ $ error_panel = new AphrontErrorView ();
52+ $ error_panel ->setWidth (AphrontErrorView::WIDTH_WIDE );
53+ $ error_panel ->setTitle ('Commit Not Tracked ' );
54+ $ error_panel ->setSeverity (AphrontErrorView::SEVERITY_WARNING );
55+ $ error_panel ->appendChild (
56+ "This Diffusion repository is configured to track only one " .
57+ "subdirectory of the entire Subversion repository, and this commit " .
58+ "didn't affect the tracked subdirectory (' " .
59+ phutil_escape_html ($ subpath )."'), so no information is available. " );
60+ $ content [] = $ error_panel ;
61+ } else {
62+ $ engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine ();
63+
64+ require_celerity_resource ('diffusion-commit-view-css ' );
65+ require_celerity_resource ('phabricator-remarkup-css ' );
66+
67+ $ property_table = $ this ->renderPropertyTable ($ commit , $ commit_data );
68+
69+ $ detail_panel ->appendChild (
70+ '<div class="diffusion-commit-view"> ' .
71+ '<div class="diffusion-commit-dateline"> ' .
72+ 'r ' .$ callsign .$ commit ->getCommitIdentifier ().
73+ ' · ' .
74+ phabricator_datetime ($ commit ->getEpoch (), $ user ).
75+ '</div> ' .
76+ '<h1>Revision Detail</h1> ' .
77+ '<div class="diffusion-commit-details"> ' .
78+ $ property_table .
79+ '<hr /> ' .
80+ '<div class="diffusion-commit-message phabricator-remarkup"> ' .
81+ $ engine ->markupText ($ commit_data ->getCommitMessage ()).
82+ '</div> ' .
6783 '</div> ' .
68- '</div> ' .
69- '</div> ' );
84+ '</div> ' );
7085
71- $ content [] = $ detail_panel ;
86+ $ content [] = $ detail_panel ;
87+ }
7288
7389 $ change_query = DiffusionPathChangeQuery::newFromDiffusionRequest (
7490 $ drequest );
@@ -103,6 +119,23 @@ public function processRequest() {
103119 phutil_escape_html ($ bad_commit ['description ' ]));
104120
105121 $ content [] = $ error_panel ;
122+ } else if ($ is_foreign ) {
123+ // Don't render anything else.
124+ } else if (!count ($ changes )) {
125+ $ no_changes = new AphrontErrorView ();
126+ $ no_changes ->setWidth (AphrontErrorView::WIDTH_WIDE );
127+ $ no_changes ->setSeverity (AphrontErrorView::SEVERITY_WARNING );
128+ $ no_changes ->setTitle ('Not Yet Parsed ' );
129+ // TODO: This can also happen with weird SVN changes that don't do
130+ // anything (or only alter properties?), although the real no-changes case
131+ // is extremely rare and might be impossible to produce organically. We
132+ // should probably write some kind of "Nothing Happened!" change into the
133+ // DB once we parse these changes so we can distinguish between
134+ // "not parsed yet" and "no changes".
135+ $ no_changes ->appendChild (
136+ "This commit hasn't been fully parsed yet (or doesn't affect any " .
137+ "paths). " );
138+ $ content [] = $ no_changes ;
106139 } else {
107140 $ change_panel = new AphrontPanelView ();
108141 $ change_panel ->setHeader ("Changes ( " .number_format ($ count ).") " );
@@ -130,60 +163,52 @@ public function processRequest() {
130163
131164 $ content [] = $ change_panel ;
132165
133- if ($ changes ) {
134- $ changesets = DiffusionPathChange::convertToDifferentialChangesets (
135- $ changes );
136-
137- $ vcs = $ repository ->getVersionControlSystem ();
138- switch ($ vcs ) {
139- case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN :
140- $ vcs_supports_directory_changes = true ;
141- break ;
142- case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT :
143- $ vcs_supports_directory_changes = false ;
144- break ;
145- default :
146- throw new Exception ("Unknown VCS. " );
147- }
166+ $ changesets = DiffusionPathChange::convertToDifferentialChangesets (
167+ $ changes );
168+
169+ $ vcs = $ repository ->getVersionControlSystem ();
170+ switch ($ vcs ) {
171+ case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN :
172+ $ vcs_supports_directory_changes = true ;
173+ break ;
174+ case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT :
175+ $ vcs_supports_directory_changes = false ;
176+ break ;
177+ default :
178+ throw new Exception ("Unknown VCS. " );
179+ }
148180
149- $ references = array ();
150- foreach ($ changesets as $ key => $ changeset ) {
151- $ file_type = $ changeset ->getFileType ();
152- if ($ file_type == DifferentialChangeType::FILE_DIRECTORY ) {
153- if (!$ vcs_supports_directory_changes ) {
154- unset($ changesets [$ key ]);
155- continue ;
156- }
181+ $ references = array ();
182+ foreach ($ changesets as $ key => $ changeset ) {
183+ $ file_type = $ changeset ->getFileType ();
184+ if ($ file_type == DifferentialChangeType::FILE_DIRECTORY ) {
185+ if (!$ vcs_supports_directory_changes ) {
186+ unset($ changesets [$ key ]);
187+ continue ;
157188 }
158-
159- $ branch = $ drequest ->getBranchURIComponent (
160- $ drequest ->getBranch ());
161- $ filename = $ changeset ->getFilename ();
162- $ commit = $ drequest ->getCommit ();
163- $ reference = "{$ branch }{$ filename }; {$ commit }" ;
164- $ references [$ key ] = $ reference ;
165189 }
166190
167- $ change_list = new DifferentialChangesetListView ();
168- $ change_list ->setChangesets ($ changesets );
169- $ change_list ->setRenderingReferences ($ references );
170- $ change_list ->setRenderURI ('/diffusion/ ' .$ callsign .'/diff/ ' );
171-
172- // TODO: This is pretty awkward, unify the CSS between Diffusion and
173- // Differential better.
174- require_celerity_resource ('differential-core-view-css ' );
175- $ change_list =
176- '<div class="differential-primary-pane"> ' .
177- $ change_list ->render ().
178- '</div> ' ;
179- } else {
180- $ change_list =
181- '<div style="margin: 2em; color: #666; padding: 1em;
182- background: #eee;"> ' .
183- '(no changes blah blah) ' .
184- '</div> ' ;
191+ $ branch = $ drequest ->getBranchURIComponent (
192+ $ drequest ->getBranch ());
193+ $ filename = $ changeset ->getFilename ();
194+ $ commit = $ drequest ->getCommit ();
195+ $ reference = "{$ branch }{$ filename }; {$ commit }" ;
196+ $ references [$ key ] = $ reference ;
185197 }
186198
199+ $ change_list = new DifferentialChangesetListView ();
200+ $ change_list ->setChangesets ($ changesets );
201+ $ change_list ->setRenderingReferences ($ references );
202+ $ change_list ->setRenderURI ('/diffusion/ ' .$ callsign .'/diff/ ' );
203+
204+ // TODO: This is pretty awkward, unify the CSS between Diffusion and
205+ // Differential better.
206+ require_celerity_resource ('differential-core-view-css ' );
207+ $ change_list =
208+ '<div class="differential-primary-pane"> ' .
209+ $ change_list ->render ().
210+ '</div> ' ;
211+
187212 $ content [] = $ change_list ;
188213 }
189214
0 commit comments