Page MenuHomePhabricator

D19296.diff
No OneTemporary

D19296.diff

diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -3,11 +3,20 @@
final class DifferentialRevisionViewController extends DifferentialController {
private $revisionID;
+ private $veryLargeDiff;
public function shouldAllowPublic() {
return true;
}
+ public function isVeryLargeDiff() {
+ return $this->veryLargeDiff;
+ }
+
+ public function getVeryLargeDiffLimit() {
+ return 1000;
+ }
+
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$this->revisionID = $request->getURIData('id');
@@ -73,6 +82,10 @@
idx($diffs, $diff_vs),
$repository);
+ if (count($rendering_references) > $this->getVeryLargeDiffLimit()) {
+ $this->veryLargeDiff = true;
+ }
+
if ($request->getExists('download')) {
return $this->buildRawDiffResponse(
$revision,
@@ -150,7 +163,7 @@
$warning->appendChild(hsprintf(
'%s <strong>%s</strong>',
pht(
- 'This diff is very large and affects %s files. '.
+ 'This diff is large and affects %s files. '.
'You may load each file individually or ',
new PhutilNumber($count)),
phutil_tag(
@@ -265,35 +278,53 @@
$timeline->setQuoteRef($revision->getMonogram());
- $changeset_view = id(new DifferentialChangesetListView())
- ->setChangesets($changesets)
- ->setVisibleChangesets($visible_changesets)
- ->setStandaloneURI('/differential/changeset/')
- ->setRawFileURIs(
- '/differential/changeset/?view=old',
- '/differential/changeset/?view=new')
- ->setUser($viewer)
- ->setDiff($target)
- ->setRenderingReferences($rendering_references)
- ->setVsMap($vs_map)
- ->setWhitespace($whitespace)
- ->setSymbolIndexes($symbol_indexes)
- ->setTitle(pht('Diff %s', $target->getID()))
- ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
+ if ($this->isVeryLargeDiff()) {
+ $messages = array();
+ $messages[] = pht(
+ 'This very large diff affects more than %s files. Use the %s to '.
+ 'browse changes.',
+ new PhutilNumber($this->getVeryLargeDiffLimit()),
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => '/differential/diff/'.$target->getID().'/changesets/',
+ ),
+ phutil_tag('strong', array(), pht('Changeset List'))));
- $revision_id = $revision->getID();
- $inline_list_uri = "/revision/inlines/{$revision_id}/";
- $inline_list_uri = $this->getApplicationURI($inline_list_uri);
- $changeset_view->setInlineListURI($inline_list_uri);
+ $changeset_view = id(new PHUIInfoView())
+ ->setErrors($messages);
+ } else {
+ $changeset_view = id(new DifferentialChangesetListView())
+ ->setChangesets($changesets)
+ ->setVisibleChangesets($visible_changesets)
+ ->setStandaloneURI('/differential/changeset/')
+ ->setRawFileURIs(
+ '/differential/changeset/?view=old',
+ '/differential/changeset/?view=new')
+ ->setUser($viewer)
+ ->setDiff($target)
+ ->setRenderingReferences($rendering_references)
+ ->setVsMap($vs_map)
+ ->setWhitespace($whitespace)
+ ->setSymbolIndexes($symbol_indexes)
+ ->setTitle(pht('Diff %s', $target->getID()))
+ ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
- if ($repository) {
- $changeset_view->setRepository($repository);
- }
- if (!$viewer_is_anonymous) {
- $changeset_view->setInlineCommentControllerURI(
- '/differential/comment/inline/edit/'.$revision->getID().'/');
+ $revision_id = $revision->getID();
+ $inline_list_uri = "/revision/inlines/{$revision_id}/";
+ $inline_list_uri = $this->getApplicationURI($inline_list_uri);
+ $changeset_view->setInlineListURI($inline_list_uri);
+
+ if ($repository) {
+ $changeset_view->setRepository($repository);
+ }
+
+ if (!$viewer_is_anonymous) {
+ $changeset_view->setInlineCommentControllerURI(
+ '/differential/comment/inline/edit/'.$revision->getID().'/');
+ }
}
$broken_diffs = $this->loadHistoryDiffStatus($diffs);
@@ -312,7 +343,7 @@
->setLocalCommits(idx($props, 'local:commits'))
->setCommitsForLinks($commits_for_links);
- if ($repository) {
+ if ($repository && !$this->isVeryLargeDiff()) {
$other_revisions = $this->loadOtherRevisions(
$changesets,
$target,
@@ -328,10 +359,14 @@
$this->buildPackageMaps($changesets);
- $toc_view = $this->buildTableOfContents(
- $changesets,
- $visible_changesets,
- $target->loadCoverageMap($viewer));
+ if ($this->isVeryLargeDiff()) {
+ $toc_view = null;
+ } else {
+ $toc_view = $this->buildTableOfContents(
+ $changesets,
+ $visible_changesets,
+ $target->loadCoverageMap($viewer));
+ }
// Attach changesets to each reviewer so we can show which Owners package
// reviewers own no files.
@@ -341,12 +376,17 @@
$reviewer->attachChangesets($reviewer_changesets);
}
- $tab_group = id(new PHUITabGroupView())
- ->addTab(
+ $tab_group = id(new PHUITabGroupView());
+
+ if ($toc_view) {
+ $tab_group->addTab(
id(new PHUITabView())
->setName(pht('Files'))
->setKey('files')
- ->appendChild($toc_view))
+ ->appendChild($toc_view));
+ }
+
+ $tab_group
->addTab(
id(new PHUITabView())
->setName(pht('History'))
@@ -479,7 +519,7 @@
PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE);
$nav = null;
- if ($filetree_on) {
+ if ($filetree_on && !$this->isVeryLargeDiff()) {
$collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
$collapsed_value = $viewer->getUserSetting($collapsed_key);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 8, 6:28 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7376398
Default Alt Text
D19296.diff (6 KB)

Event Timeline