2011-03-08 02:25:47 +01:00
|
|
|
<?php
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
final class DiffusionBrowseController extends DiffusionController {
|
|
|
|
|
|
|
|
private $lintCommit;
|
|
|
|
private $lintMessages;
|
|
|
|
private $coverage;
|
2017-08-21 22:07:38 +02:00
|
|
|
private $corpusButtons = array();
|
2013-09-19 20:57:33 +02:00
|
|
|
|
2013-09-23 21:53:41 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$response = $this->loadDiffusionContext();
|
|
|
|
if ($response) {
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
|
|
|
// Figure out if we're browsing a directory, a file, or a search result
|
|
|
|
// list.
|
|
|
|
|
|
|
|
$grep = $request->getStr('grep');
|
2017-08-15 01:29:27 +02:00
|
|
|
if (strlen($grep)) {
|
2016-01-05 14:18:59 +01:00
|
|
|
return $this->browseSearch();
|
|
|
|
}
|
|
|
|
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
$pager = id(new PHUIPagerView())
|
|
|
|
->readFromRequest($request);
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$results = DiffusionBrowseResultSet::newFromConduit(
|
|
|
|
$this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.browsequery',
|
|
|
|
array(
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'commit' => $drequest->getStableCommit(),
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
'offset' => $pager->getOffset(),
|
|
|
|
'limit' => $pager->getPageSize() + 1,
|
2016-01-05 14:18:59 +01:00
|
|
|
)));
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$reason = $results->getReasonForEmptyResultSet();
|
|
|
|
$is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE);
|
|
|
|
|
|
|
|
if ($is_file) {
|
2017-02-17 11:10:15 +01:00
|
|
|
return $this->browseFile();
|
2016-01-05 14:18:59 +01:00
|
|
|
} else {
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
$paths = $results->getPaths();
|
|
|
|
$paths = $pager->sliceResults($paths);
|
|
|
|
$results->setPaths($paths);
|
|
|
|
|
|
|
|
return $this->browseDirectory($results, $pager);
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function browseSearch() {
|
2016-03-17 20:01:22 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$header = $this->buildHeaderView($drequest);
|
2017-08-15 23:14:08 +02:00
|
|
|
$path = nonempty(basename($drequest->getPath()), '/');
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$search_results = $this->renderSearchResults();
|
2017-08-15 23:14:08 +02:00
|
|
|
$search_form = $this->renderSearchForm($path);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2017-08-15 01:29:27 +02:00
|
|
|
$search_form = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-mobile-search-form',
|
|
|
|
),
|
|
|
|
$search_form);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'branch' => true,
|
|
|
|
'path' => true,
|
|
|
|
'view' => 'browse',
|
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
$crumbs->setBorder(true);
|
|
|
|
|
2017-08-16 21:07:14 +02:00
|
|
|
$tabs = $this->buildTabsView('code');
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
2017-08-16 21:07:14 +02:00
|
|
|
->setTabs($tabs)
|
2016-12-06 03:09:51 +01:00
|
|
|
->setFooter(
|
|
|
|
array(
|
2016-03-17 20:01:22 +01:00
|
|
|
$search_form,
|
|
|
|
$search_results,
|
|
|
|
));
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
return $this->newPage()
|
|
|
|
->setTitle(
|
|
|
|
array(
|
|
|
|
nonempty(basename($drequest->getPath()), '/'),
|
|
|
|
$drequest->getRepository()->getDisplayName(),
|
|
|
|
))
|
|
|
|
->setCrumbs($crumbs)
|
2016-03-17 20:01:22 +01:00
|
|
|
->appendChild($view);
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function browseFile() {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$before = $request->getStr('before');
|
|
|
|
if ($before) {
|
|
|
|
return $this->buildBeforeResponse($before);
|
|
|
|
}
|
|
|
|
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
|
2016-06-03 16:48:26 +02:00
|
|
|
$blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY;
|
2016-01-05 14:18:59 +01:00
|
|
|
$show_blame = $request->getBool(
|
|
|
|
'blame',
|
2016-06-03 16:48:26 +02:00
|
|
|
$viewer->getUserSetting($blame_key));
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$view = $request->getStr('view');
|
|
|
|
if ($request->isFormPost() && $view != 'raw' && $viewer->isLoggedIn()) {
|
2016-06-03 16:48:26 +02:00
|
|
|
$preferences = PhabricatorUserPreferences::loadUserPreferences($viewer);
|
|
|
|
|
|
|
|
$editor = id(new PhabricatorUserPreferencesEditor())
|
|
|
|
->setActor($viewer)
|
|
|
|
->setContentSourceFromRequest($request)
|
|
|
|
->setContinueOnNoEffect(true)
|
|
|
|
->setContinueOnMissingFields(true);
|
|
|
|
|
|
|
|
$xactions = array();
|
|
|
|
$xactions[] = $preferences->newTransaction($blame_key, $show_blame);
|
|
|
|
$editor->applyTransactions($preferences, $xactions);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$uri = $request->getRequestURI()
|
2016-11-10 01:40:09 +01:00
|
|
|
->alter('blame', null);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
return id(new AphrontRedirectResponse())->setURI($uri);
|
|
|
|
}
|
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
// We need the blame information if blame is on and this is an Ajax request.
|
|
|
|
// If blame is on and this is a colorized request, we don't show blame at
|
|
|
|
// first (we ajax it in afterward) so we don't need to query for it.
|
|
|
|
$needs_blame = ($show_blame && $request->isAjax());
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
);
|
|
|
|
|
|
|
|
$byte_limit = null;
|
|
|
|
if ($view !== 'raw') {
|
|
|
|
$byte_limit = PhabricatorFileStorageEngine::getChunkThreshold();
|
|
|
|
$time_limit = 10;
|
|
|
|
|
|
|
|
$params += array(
|
|
|
|
'timeout' => $time_limit,
|
|
|
|
'byteLimit' => $byte_limit,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-01-07 12:50:16 +01:00
|
|
|
$response = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.filecontentquery',
|
|
|
|
$params);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-01-07 12:50:16 +01:00
|
|
|
$hit_byte_limit = $response['tooHuge'];
|
|
|
|
$hit_time_limit = $response['tooSlow'];
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-01-07 12:50:16 +01:00
|
|
|
$file_phid = $response['filePHID'];
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$show_editor = false;
|
2016-01-07 12:50:16 +01:00
|
|
|
if ($hit_byte_limit) {
|
2016-01-05 14:18:59 +01:00
|
|
|
$corpus = $this->buildErrorCorpus(
|
|
|
|
pht(
|
|
|
|
'This file is larger than %s byte(s), and too large to display '.
|
|
|
|
'in the web UI.',
|
2016-01-07 12:50:16 +01:00
|
|
|
phutil_format_bytes($byte_limit)));
|
|
|
|
} else if ($hit_time_limit) {
|
|
|
|
$corpus = $this->buildErrorCorpus(
|
|
|
|
pht(
|
|
|
|
'This file took too long to load from the repository (more than '.
|
|
|
|
'%s second(s)).',
|
|
|
|
new PhutilNumber($time_limit)));
|
|
|
|
} else {
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withPHIDs(array($file_phid))
|
|
|
|
->executeOne();
|
|
|
|
if (!$file) {
|
|
|
|
throw new Exception(pht('Failed to load content file!'));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($view === 'raw') {
|
|
|
|
return $file->getRedirectResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = $file->loadFileData();
|
2016-03-18 16:13:20 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$lfs_ref = $this->getGitLFSRef($repository, $data);
|
|
|
|
if ($lfs_ref) {
|
2016-03-18 16:13:20 +01:00
|
|
|
if ($view == 'git-lfs') {
|
2016-11-10 01:40:09 +01:00
|
|
|
$file = $this->loadGitLFSFile($lfs_ref);
|
2016-03-18 16:13:20 +01:00
|
|
|
|
|
|
|
// Rename the file locally so we generate a better vanity URI for
|
|
|
|
// it. In storage, it just has a name like "lfs-13f9a94c0923...",
|
|
|
|
// since we don't get any hints about possible human-readable names
|
|
|
|
// at upload time.
|
|
|
|
$basename = basename($drequest->getPath());
|
|
|
|
$file->makeEphemeral();
|
|
|
|
$file->setName($basename);
|
|
|
|
|
|
|
|
return $file->getRedirectResponse();
|
|
|
|
} else {
|
2016-11-10 01:40:09 +01:00
|
|
|
$corpus = $this->buildGitLFSCorpus($lfs_ref);
|
2016-03-18 16:13:20 +01:00
|
|
|
}
|
|
|
|
} else if (ArcanistDiffUtils::isHeuristicBinaryFile($data)) {
|
2016-01-07 12:50:16 +01:00
|
|
|
$file_uri = $file->getBestURI();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-01-07 12:50:16 +01:00
|
|
|
if ($file->isViewableImage()) {
|
|
|
|
$corpus = $this->buildImageCorpus($file_uri);
|
|
|
|
} else {
|
|
|
|
$corpus = $this->buildBinaryCorpus($file_uri, $data);
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
} else {
|
2016-01-07 12:50:16 +01:00
|
|
|
$this->loadLintMessages();
|
|
|
|
$this->coverage = $drequest->loadCoverage();
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$show_editor = true;
|
2016-01-07 12:50:16 +01:00
|
|
|
|
|
|
|
// Build the content of the file.
|
|
|
|
$corpus = $this->buildCorpus(
|
|
|
|
$show_blame,
|
|
|
|
$data,
|
|
|
|
$needs_blame,
|
|
|
|
$drequest,
|
|
|
|
$path,
|
|
|
|
$data);
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request->isAjax()) {
|
|
|
|
return id(new AphrontAjaxResponse())->setContent($corpus);
|
|
|
|
}
|
|
|
|
|
|
|
|
require_celerity_resource('diffusion-source-css');
|
|
|
|
|
|
|
|
// Render the page.
|
2017-08-21 22:07:38 +02:00
|
|
|
$bar = $this->buildButtonBar($drequest, $show_blame, $show_editor);
|
2016-03-17 20:01:22 +01:00
|
|
|
$header = $this->buildHeaderView($drequest);
|
|
|
|
$header->setHeaderIcon('fa-file-code-o');
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$follow = $request->getStr('follow');
|
2017-08-21 22:07:38 +02:00
|
|
|
$follow_notice = null;
|
2016-01-05 14:18:59 +01:00
|
|
|
if ($follow) {
|
2017-08-21 22:07:38 +02:00
|
|
|
$follow_notice = id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
|
|
|
->setTitle(pht('Unable to Continue'));
|
2016-01-05 14:18:59 +01:00
|
|
|
switch ($follow) {
|
|
|
|
case 'first':
|
2017-08-21 22:07:38 +02:00
|
|
|
$follow_notice->appendChild(
|
2016-01-05 14:18:59 +01:00
|
|
|
pht(
|
|
|
|
'Unable to continue tracing the history of this file because '.
|
|
|
|
'this commit is the first commit in the repository.'));
|
|
|
|
break;
|
|
|
|
case 'created':
|
2017-08-21 22:07:38 +02:00
|
|
|
$follow_notice->appendChild(
|
2016-01-05 14:18:59 +01:00
|
|
|
pht(
|
|
|
|
'Unable to continue tracing the history of this file because '.
|
|
|
|
'this commit created the file.'));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$renamed = $request->getStr('renamed');
|
2017-08-21 22:07:38 +02:00
|
|
|
$renamed_notice = null;
|
2016-01-05 14:18:59 +01:00
|
|
|
if ($renamed) {
|
2017-08-21 22:07:38 +02:00
|
|
|
$renamed_notice = id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
|
|
|
->setTitle(pht('File Renamed'))
|
|
|
|
->appendChild(
|
|
|
|
pht(
|
|
|
|
'File history passes through a rename from "%s" to "%s".',
|
|
|
|
$drequest->getPath(),
|
|
|
|
$renamed));
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$open_revisions = $this->buildOpenRevisions();
|
|
|
|
$owners_list = $this->buildOwnersList($drequest);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'branch' => true,
|
|
|
|
'path' => true,
|
|
|
|
'view' => 'browse',
|
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
$crumbs->setBorder(true);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$basename = basename($this->getDiffusionRequest()->getPath());
|
2017-08-16 21:07:14 +02:00
|
|
|
$tabs = $this->buildTabsView('code');
|
2017-08-21 22:07:38 +02:00
|
|
|
$bar->setRight($this->corpusButtons);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
2017-08-16 21:07:14 +02:00
|
|
|
->setTabs($tabs)
|
2017-08-21 22:07:38 +02:00
|
|
|
->setFooter(array(
|
|
|
|
$bar,
|
|
|
|
$follow_notice,
|
|
|
|
$renamed_notice,
|
|
|
|
$corpus,
|
|
|
|
$open_revisions,
|
|
|
|
$owners_list,
|
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
|
|
|
$title = array($basename, $repository->getDisplayName());
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
return $this->newPage()
|
2016-03-17 20:01:22 +01:00
|
|
|
->setTitle($title)
|
2016-01-05 14:18:59 +01:00
|
|
|
->setCrumbs($crumbs)
|
2016-03-17 20:01:22 +01:00
|
|
|
->appendChild(
|
|
|
|
array(
|
|
|
|
$view,
|
|
|
|
));
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
public function browseDirectory(
|
|
|
|
DiffusionBrowseResultSet $results,
|
|
|
|
PHUIPagerView $pager) {
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$reason = $results->getReasonForEmptyResultSet();
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->buildActionButtons($drequest, true);
|
2016-03-17 20:01:22 +01:00
|
|
|
$details = $this->buildPropertyView($drequest);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$header = $this->buildHeaderView($drequest);
|
|
|
|
$header->setHeaderIcon('fa-folder-open');
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$empty_result = null;
|
|
|
|
$browse_panel = null;
|
2016-12-06 03:09:51 +01:00
|
|
|
$branch_panel = null;
|
2016-01-05 14:18:59 +01:00
|
|
|
if (!$results->isValidResults()) {
|
|
|
|
$empty_result = new DiffusionEmptyResultView();
|
|
|
|
$empty_result->setDiffusionRequest($drequest);
|
|
|
|
$empty_result->setDiffusionBrowseResultSet($results);
|
|
|
|
$empty_result->setView($request->getStr('view'));
|
|
|
|
} else {
|
|
|
|
$phids = array();
|
|
|
|
foreach ($results->getPaths() as $result) {
|
|
|
|
$data = $result->getLastCommitData();
|
|
|
|
if ($data) {
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$phids = array_keys($phids);
|
|
|
|
$handles = $this->loadViewerHandles($phids);
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$browse_table = id(new DiffusionBrowseTableView())
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setHandles($handles)
|
|
|
|
->setPaths($results->getPaths())
|
|
|
|
->setUser($request->getUser());
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$title = nonempty(basename($drequest->getPath()), '/');
|
|
|
|
$icon = 'fa-folder-open';
|
2017-08-21 22:07:38 +02:00
|
|
|
$browse_header = $this->buildPanelHeaderView($title, $icon);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$browse_panel = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($browse_header)
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
2017-04-21 20:22:06 +02:00
|
|
|
->setTable($browse_table)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2017-04-21 20:22:06 +02:00
|
|
|
->setPager($pager);
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2016-12-06 03:09:51 +01:00
|
|
|
$path = $drequest->getPath();
|
|
|
|
$is_branch = (!strlen($path) && $repository->supportsBranchComparison());
|
|
|
|
if ($is_branch) {
|
|
|
|
$branch_panel = $this->buildBranchTable();
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$open_revisions = $this->buildOpenRevisions();
|
|
|
|
$readme = $this->renderDirectoryReadme($results);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'branch' => true,
|
|
|
|
'path' => true,
|
|
|
|
'view' => 'browse',
|
|
|
|
));
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$crumbs->setBorder(true);
|
2017-08-16 21:07:14 +02:00
|
|
|
$tabs = $this->buildTabsView('code');
|
2017-08-21 22:07:38 +02:00
|
|
|
$owners_list = $this->buildOwnersList($drequest);
|
|
|
|
$bar = id(new PHUILeftRightView())
|
|
|
|
->setRight($this->corpusButtons)
|
|
|
|
->addClass('diffusion-action-bar');
|
2016-03-17 20:01:22 +01:00
|
|
|
|
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
2017-08-16 21:07:14 +02:00
|
|
|
->setTabs($tabs)
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
->setFooter(
|
2016-12-06 03:09:51 +01:00
|
|
|
array(
|
2017-08-21 22:07:38 +02:00
|
|
|
$bar,
|
2016-12-06 03:09:51 +01:00
|
|
|
$branch_panel,
|
|
|
|
$empty_result,
|
|
|
|
$browse_panel,
|
2016-03-17 20:01:22 +01:00
|
|
|
$open_revisions,
|
2017-08-21 22:07:38 +02:00
|
|
|
$owners_list,
|
2016-03-17 20:01:22 +01:00
|
|
|
$readme,
|
2016-12-06 03:09:51 +01:00
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
|
|
|
if ($details) {
|
2016-04-07 00:20:53 +02:00
|
|
|
$view->addPropertySection(pht('Details'), $details);
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
return $this->newPage()
|
2016-03-17 20:01:22 +01:00
|
|
|
->setTitle(array(
|
2016-01-05 14:18:59 +01:00
|
|
|
nonempty(basename($drequest->getPath()), '/'),
|
|
|
|
$repository->getDisplayName(),
|
|
|
|
))
|
|
|
|
->setCrumbs($crumbs)
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
->appendChild(
|
|
|
|
array(
|
2016-03-17 20:01:22 +01:00
|
|
|
$view,
|
Improve Diffusion behavior for directories with impressive numbers of files
Summary:
Fixes T4366. Two years ago, Facebook put 16,000 files in a directory. Today, the page has nearly loaded.
Paginate large directories.
Test Plan:
- Viewed home and browse views in Git, Mercurial and Subversion.
I put an artificially small page size (5) on home:
{F1055653}
I pushed 16,000 files to a directory and paged through them. Here's the last page, which rendered in about 200ms:
{F1055655}
Our behavior is a bit better than GitHub here, which shows only the first 1,000 files, disables pagination, and can't retrieve history for the files:
{F1055656}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4366
Differential Revision: https://secure.phabricator.com/D14956
2016-01-06 12:57:57 +01:00
|
|
|
));
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function renderSearchResults() {
|
2016-01-05 14:56:35 +01:00
|
|
|
$request = $this->getRequest();
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$results = array();
|
|
|
|
|
2016-01-05 14:56:35 +01:00
|
|
|
$pager = id(new PHUIPagerView())
|
|
|
|
->readFromRequest($request);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$search_mode = null;
|
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$results = array();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (strlen($this->getRequest()->getStr('grep'))) {
|
|
|
|
$search_mode = 'grep';
|
2016-01-05 14:56:35 +01:00
|
|
|
$query_string = $request->getStr('grep');
|
2016-01-05 14:18:59 +01:00
|
|
|
$results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.searchquery',
|
|
|
|
array(
|
|
|
|
'grep' => $query_string,
|
|
|
|
'commit' => $drequest->getStableCommit(),
|
|
|
|
'path' => $drequest->getPath(),
|
2016-01-05 14:56:35 +01:00
|
|
|
'limit' => $pager->getPageSize() + 1,
|
|
|
|
'offset' => $pager->getOffset(),
|
2016-01-05 14:18:59 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$results = $pager->sliceResults($results);
|
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
$table = null;
|
|
|
|
$header = null;
|
2016-01-05 14:18:59 +01:00
|
|
|
if ($search_mode == 'grep') {
|
|
|
|
$table = $this->renderGrepResults($results, $query_string);
|
2017-08-15 05:50:06 +02:00
|
|
|
$title = pht(
|
2016-01-05 14:18:59 +01:00
|
|
|
'File content matching "%s" under "%s"',
|
|
|
|
$query_string,
|
|
|
|
nonempty($drequest->getPath(), '/'));
|
2017-08-15 05:50:06 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader($title)
|
|
|
|
->addClass('diffusion-search-result-header');
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
return array($header, $table, $pager);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderGrepResults(array $results, $pattern) {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
require_celerity_resource('phabricator-search-results-css');
|
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
if (!$results) {
|
|
|
|
return id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_NODATA)
|
|
|
|
->appendChild(
|
|
|
|
pht(
|
|
|
|
'The pattern you searched for was not found in the content of any '.
|
|
|
|
'files.'));
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
$grouped = array();
|
|
|
|
foreach ($results as $file) {
|
|
|
|
list($path, $line, $string) = $file;
|
|
|
|
$grouped[$path][] = array($line, $string);
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
$view = array();
|
|
|
|
foreach ($grouped as $path => $matches) {
|
|
|
|
$view[] = id(new DiffusionPatternSearchView())
|
|
|
|
->setPath($path)
|
|
|
|
->setMatches($matches)
|
|
|
|
->setPattern($pattern)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->render();
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2017-08-15 05:50:06 +02:00
|
|
|
return $view;
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function loadLintMessages() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$branch = $drequest->loadBranch();
|
|
|
|
|
|
|
|
if (!$branch || !$branch->getLintCommit()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->lintCommit = $branch->getLintCommit();
|
|
|
|
|
|
|
|
$conn = id(new PhabricatorRepository())->establishConnection('r');
|
|
|
|
|
|
|
|
$where = '';
|
|
|
|
if ($drequest->getLint()) {
|
|
|
|
$where = qsprintf(
|
|
|
|
$conn,
|
|
|
|
'AND code = %s',
|
|
|
|
$drequest->getLint());
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->lintMessages = queryfx_all(
|
|
|
|
$conn,
|
|
|
|
'SELECT * FROM %T WHERE branchID = %d %Q AND path = %s',
|
|
|
|
PhabricatorRepository::TABLE_LINTMESSAGE,
|
|
|
|
$branch->getID(),
|
|
|
|
$where,
|
|
|
|
'/'.$drequest->getPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildCorpus(
|
|
|
|
$show_blame,
|
2016-01-07 12:50:16 +01:00
|
|
|
$file_corpus,
|
2016-01-05 14:18:59 +01:00
|
|
|
$needs_blame,
|
|
|
|
DiffusionRequest $drequest,
|
|
|
|
$path,
|
|
|
|
$data) {
|
|
|
|
|
2016-01-06 15:15:25 +01:00
|
|
|
$viewer = $this->getViewer();
|
2016-01-07 03:08:07 +01:00
|
|
|
$blame_timeout = 15;
|
|
|
|
$blame_failed = false;
|
2016-01-06 15:15:25 +01:00
|
|
|
|
2016-01-07 03:08:07 +01:00
|
|
|
$highlight_limit = DifferentialChangesetParser::HIGHLIGHT_BYTE_LIMIT;
|
|
|
|
$blame_limit = DifferentialChangesetParser::HIGHLIGHT_BYTE_LIMIT;
|
|
|
|
$can_highlight = (strlen($file_corpus) <= $highlight_limit);
|
|
|
|
$can_blame = (strlen($file_corpus) <= $blame_limit);
|
|
|
|
|
|
|
|
if ($needs_blame && $can_blame) {
|
|
|
|
$blame = $this->loadBlame($path, $drequest->getCommit(), $blame_timeout);
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
list($blame_list, $blame_commits) = $blame;
|
2016-01-07 03:08:07 +01:00
|
|
|
if ($blame_list === null) {
|
|
|
|
$blame_failed = true;
|
|
|
|
$blame_list = array();
|
|
|
|
}
|
2016-01-06 15:15:25 +01:00
|
|
|
} else {
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$blame_list = array();
|
|
|
|
$blame_commits = array();
|
2016-01-06 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
require_celerity_resource('syntax-highlighting-css');
|
|
|
|
if ($can_highlight) {
|
|
|
|
$highlighted = PhabricatorSyntaxHighlighter::highlightWithFilename(
|
|
|
|
$path,
|
|
|
|
$file_corpus);
|
2016-01-05 14:18:59 +01:00
|
|
|
} else {
|
2016-11-10 01:40:09 +01:00
|
|
|
// Highlight as plain text to escape the content properly.
|
|
|
|
$highlighted = PhabricatorSyntaxHighlighter::highlightWithLanguage(
|
|
|
|
'txt',
|
|
|
|
$file_corpus);
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$lines = phutil_split_lines($highlighted);
|
2016-07-02 14:17:05 +02:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$rows = $this->buildDisplayRows(
|
|
|
|
$lines,
|
|
|
|
$blame_list,
|
|
|
|
$blame_commits,
|
|
|
|
$show_blame);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$corpus_table = javelin_tag(
|
|
|
|
'table',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-source remarkup-code PhabricatorMonospaced',
|
|
|
|
'sigil' => 'phabricator-source',
|
2018-03-07 16:02:34 +01:00
|
|
|
'meta' => array(
|
|
|
|
'uri' => $this->getLineNumberBaseURI(),
|
|
|
|
),
|
2016-11-10 01:40:09 +01:00
|
|
|
),
|
|
|
|
$rows);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
$corpus_table = phutil_tag_div('diffusion-source-wrap', $corpus_table);
|
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
if ($this->getRequest()->isAjax()) {
|
|
|
|
return $corpus_table;
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$id = celerity_generate_unique_node_id();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$repo = $drequest->getRepository();
|
|
|
|
$symbol_repos = nonempty($repo->getSymbolSources(), array());
|
|
|
|
$symbol_repos[] = $repo->getPHID();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$lang = last(explode('.', $drequest->getPath()));
|
|
|
|
$repo_languages = $repo->getSymbolLanguages();
|
|
|
|
$repo_languages = nonempty($repo_languages, array());
|
|
|
|
$repo_languages = array_fill_keys($repo_languages, true);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$needs_symbols = true;
|
|
|
|
if ($repo_languages && $symbol_repos) {
|
|
|
|
$have_symbols = id(new DiffusionSymbolQuery())
|
|
|
|
->existsSymbolsInRepository($repo->getPHID());
|
|
|
|
if (!$have_symbols) {
|
|
|
|
$needs_symbols = false;
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
2016-11-10 01:40:09 +01:00
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
if ($needs_symbols && $repo_languages) {
|
|
|
|
$needs_symbols = isset($repo_languages[$lang]);
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
if ($needs_symbols) {
|
|
|
|
Javelin::initBehavior(
|
|
|
|
'repository-crossreference',
|
2016-01-05 14:18:59 +01:00
|
|
|
array(
|
2016-11-10 01:40:09 +01:00
|
|
|
'container' => $id,
|
|
|
|
'lang' => $lang,
|
|
|
|
'repositories' => $symbol_repos,
|
|
|
|
));
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2016-11-10 01:40:09 +01:00
|
|
|
$corpus = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'id' => $id,
|
|
|
|
),
|
|
|
|
$corpus_table);
|
|
|
|
|
|
|
|
Javelin::initBehavior('load-blame', array('id' => $id));
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $this->renderFileButton();
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$title = basename($this->getDiffusionRequest()->getPath());
|
|
|
|
$icon = 'fa-file-code-o';
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->buildActionButtons($drequest);
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$header = $this->buildPanelHeaderView($title, $icon);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$corpus = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
2016-03-17 20:01:22 +01:00
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
2016-01-05 14:18:59 +01:00
|
|
|
->appendChild($corpus)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2018-01-26 15:42:16 +01:00
|
|
|
->addSigil('diffusion-file-content-view')
|
|
|
|
->setMetadata(
|
|
|
|
array(
|
|
|
|
'path' => $this->getDiffusionRequest()->getPath(),
|
|
|
|
))
|
2016-01-05 14:18:59 +01:00
|
|
|
->setCollapsed(true);
|
|
|
|
|
2016-01-07 03:08:07 +01:00
|
|
|
$messages = array();
|
|
|
|
|
2016-01-06 15:41:38 +01:00
|
|
|
if (!$can_highlight) {
|
2016-01-07 03:08:07 +01:00
|
|
|
$messages[] = pht(
|
2016-01-06 15:41:38 +01:00
|
|
|
'This file is larger than %s, so syntax highlighting is disabled '.
|
|
|
|
'by default.',
|
|
|
|
phutil_format_bytes($highlight_limit));
|
2016-01-07 03:08:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($show_blame && !$can_blame) {
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file is larger than %s, so blame is disabled.',
|
|
|
|
phutil_format_bytes($blame_limit));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($blame_failed) {
|
|
|
|
$messages[] = pht(
|
|
|
|
'Failed to load blame information for this file in %s second(s).',
|
|
|
|
new PhutilNumber($blame_timeout));
|
|
|
|
}
|
2016-01-06 15:41:38 +01:00
|
|
|
|
2016-01-07 03:08:07 +01:00
|
|
|
if ($messages) {
|
2016-01-06 15:41:38 +01:00
|
|
|
$corpus->setInfoView(
|
|
|
|
id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
2016-01-07 03:08:07 +01:00
|
|
|
->setErrors($messages));
|
2016-01-06 15:41:38 +01:00
|
|
|
}
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
return $corpus;
|
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
private function buildButtonBar(
|
2016-01-05 14:18:59 +01:00
|
|
|
DiffusionRequest $drequest,
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$show_blame,
|
|
|
|
$show_editor) {
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$viewer = $this->getViewer();
|
2016-01-05 14:18:59 +01:00
|
|
|
$base_uri = $this->getRequest()->getRequestURI();
|
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
$line = nonempty((int)$drequest->getLine(), 1);
|
2017-08-21 22:07:38 +02:00
|
|
|
$buttons = array();
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
|
|
|
|
$editor_link = $user->loadEditorLink($path, $line, $repository);
|
|
|
|
$template = $user->loadEditorLink($path, '%l', $repository);
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$buttons[] =
|
|
|
|
id(new PHUIButtonView())
|
2017-08-25 04:36:33 +02:00
|
|
|
->setTag('a')
|
2017-08-21 22:07:38 +02:00
|
|
|
->setText(pht('Last Change'))
|
|
|
|
->setColor(PHUIButtonView::GREY)
|
2016-01-05 14:18:59 +01:00
|
|
|
->setHref(
|
|
|
|
$drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'change',
|
|
|
|
)))
|
2017-08-21 22:07:38 +02:00
|
|
|
->setIcon('fa-backward');
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
if ($show_blame) {
|
|
|
|
$blame_text = pht('Disable Blame');
|
|
|
|
$blame_icon = 'fa-exclamation-circle lightgreytext';
|
|
|
|
$blame_value = 0;
|
|
|
|
} else {
|
|
|
|
$blame_text = pht('Enable Blame');
|
|
|
|
$blame_icon = 'fa-exclamation-circle';
|
|
|
|
$blame_value = 1;
|
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$blame = id(new PHUIButtonView())
|
|
|
|
->setText($blame_text)
|
|
|
|
->setIcon($blame_icon)
|
|
|
|
->setUser($viewer)
|
2017-08-30 20:33:42 +02:00
|
|
|
->setSelected(!$blame_value)
|
2017-08-21 22:07:38 +02:00
|
|
|
->setColor(PHUIButtonView::GREY);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
if ($viewer->isLoggedIn()) {
|
|
|
|
$blame = phabricator_form(
|
|
|
|
$viewer,
|
|
|
|
array(
|
|
|
|
'action' => $base_uri->alter('blame', $blame_value),
|
|
|
|
'method' => 'POST',
|
|
|
|
'style' => 'display: inline-block;',
|
|
|
|
),
|
|
|
|
$blame);
|
|
|
|
} else {
|
|
|
|
$blame->setTag('a');
|
|
|
|
$blame->setHref($base_uri->alter('blame', $blame_value));
|
|
|
|
}
|
|
|
|
$buttons[] = $blame;
|
|
|
|
|
|
|
|
if ($editor_link) {
|
|
|
|
$buttons[] =
|
|
|
|
id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setText(pht('Open File'))
|
|
|
|
->setHref($editor_link)
|
|
|
|
->setIcon('fa-pencil')
|
|
|
|
->setID('editor_link')
|
|
|
|
->setMetadata(array('link_template' => $template))
|
|
|
|
->setDisabled(!$editor_link)
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
|
|
|
}
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$href = null;
|
2017-08-21 22:07:38 +02:00
|
|
|
$show_lint = true;
|
2016-01-05 14:18:59 +01:00
|
|
|
if ($this->getRequest()->getStr('lint') !== null) {
|
2017-08-21 22:07:38 +02:00
|
|
|
$lint_text = pht('Hide Lint');
|
2016-01-05 14:18:59 +01:00
|
|
|
$href = $base_uri->alter('lint', null);
|
|
|
|
|
|
|
|
} else if ($this->lintCommit === null) {
|
2017-08-21 22:07:38 +02:00
|
|
|
$show_lint = false;
|
2016-01-05 14:18:59 +01:00
|
|
|
} else {
|
2017-08-21 22:07:38 +02:00
|
|
|
$lint_text = pht('Show Lint');
|
2016-01-05 14:18:59 +01:00
|
|
|
$href = $this->getDiffusionRequest()->generateURI(array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'commit' => $this->lintCommit,
|
|
|
|
))->alter('lint', '');
|
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
if ($show_lint) {
|
|
|
|
$buttons[] =
|
|
|
|
id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setText($lint_text)
|
|
|
|
->setHref($href)
|
|
|
|
->setIcon('fa-exclamation-triangle')
|
|
|
|
->setDisabled(!$href)
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
|
|
|
}
|
|
|
|
|
|
|
|
$bar = id(new PHUILeftRightView())
|
|
|
|
->setLeft($buttons)
|
|
|
|
->addClass('diffusion-action-bar full-mobile-buttons');
|
|
|
|
return $bar;
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
private function buildOwnersList(DiffusionRequest $drequest) {
|
|
|
|
$viewer = $this->getViewer();
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$have_owners = PhabricatorApplication::isClassInstalledForViewer(
|
|
|
|
'PhabricatorOwnersApplication',
|
|
|
|
$viewer);
|
|
|
|
if (!$have_owners) {
|
|
|
|
return null;
|
|
|
|
}
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$repository = $drequest->getRepository();
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$package_query = id(new PhabricatorOwnersPackageQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))
|
|
|
|
->withControl(
|
2016-03-17 20:01:22 +01:00
|
|
|
$repository->getPHID(),
|
2017-09-19 18:22:10 +02:00
|
|
|
array(
|
|
|
|
$drequest->getPath(),
|
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$package_query->execute();
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$packages = $package_query->getControllingPackagesForPath(
|
|
|
|
$repository->getPHID(),
|
|
|
|
$drequest->getPath());
|
|
|
|
|
|
|
|
$ownership = id(new PHUIObjectItemListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setNoDataString(pht('No Owners'));
|
|
|
|
|
|
|
|
if ($packages) {
|
|
|
|
foreach ($packages as $package) {
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
|
|
->setObject($package)
|
|
|
|
->setObjectName($package->getMonogram())
|
|
|
|
->setHeader($package->getName())
|
|
|
|
->setHref($package->getURI());
|
|
|
|
|
|
|
|
$owners = $package->getOwners();
|
|
|
|
if ($owners) {
|
|
|
|
$owner_list = $viewer->renderHandleList(
|
|
|
|
mpull($owners, 'getUserPHID'));
|
|
|
|
} else {
|
|
|
|
$owner_list = phutil_tag('em', array(), pht('None'));
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
2017-09-19 18:22:10 +02:00
|
|
|
$item->addAttribute(pht('Owners: %s', $owner_list));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$auto = $package->getAutoReview();
|
|
|
|
$autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap();
|
|
|
|
$spec = idx($autoreview_map, $auto, array());
|
|
|
|
$name = idx($spec, 'name', $auto);
|
|
|
|
$item->addIcon('fa-code', $name);
|
|
|
|
|
|
|
|
if ($package->getAuditingEnabled()) {
|
|
|
|
$item->addIcon('fa-check', pht('Auditing Enabled'));
|
|
|
|
} else {
|
|
|
|
$item->addIcon('fa-ban', pht('No Auditing'));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($package->isArchived()) {
|
|
|
|
$item->setDisabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
$ownership->addItem($item);
|
|
|
|
}
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
|
|
|
|
2017-09-19 18:22:10 +02:00
|
|
|
$view = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText(pht('Owner Packages'))
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
|
|
->addClass('diffusion-mobile-view')
|
|
|
|
->setObjectList($ownership);
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
return $view;
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
2016-03-18 16:13:20 +01:00
|
|
|
private function renderFileButton($file_uri = null, $label = null) {
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$base_uri = $this->getRequest()->getRequestURI();
|
|
|
|
|
|
|
|
if ($file_uri) {
|
2017-08-21 22:07:38 +02:00
|
|
|
$text = pht('Download File');
|
2016-01-05 14:18:59 +01:00
|
|
|
$href = $file_uri;
|
|
|
|
$icon = 'fa-download';
|
|
|
|
} else {
|
2017-08-21 22:07:38 +02:00
|
|
|
$text = pht('Raw File');
|
2016-01-05 14:18:59 +01:00
|
|
|
$href = $base_uri->alter('view', 'raw');
|
|
|
|
$icon = 'fa-file-text';
|
|
|
|
}
|
|
|
|
|
2016-03-18 16:13:20 +01:00
|
|
|
if ($label !== null) {
|
|
|
|
$text = $label;
|
|
|
|
}
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$button = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setText($text)
|
|
|
|
->setHref($href)
|
2017-08-21 22:07:38 +02:00
|
|
|
->setIcon($icon)
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
return $button;
|
|
|
|
}
|
|
|
|
|
2016-03-18 16:13:20 +01:00
|
|
|
private function renderGitLFSButton() {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$uri = $this->getRequest()->getRequestURI();
|
|
|
|
$href = $uri->alter('view', 'git-lfs');
|
|
|
|
|
|
|
|
$text = pht('Download from Git LFS');
|
|
|
|
$icon = 'fa-download';
|
|
|
|
|
|
|
|
return id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setText($text)
|
|
|
|
->setHref($href)
|
2017-12-13 15:02:09 +01:00
|
|
|
->setIcon($icon)
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
2016-03-18 16:13:20 +01:00
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
private function buildDisplayRows(
|
2016-01-06 15:15:25 +01:00
|
|
|
array $lines,
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
array $blame_list,
|
|
|
|
array $blame_commits,
|
2016-11-10 01:40:09 +01:00
|
|
|
$show_blame) {
|
2016-01-06 15:15:25 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $this->getViewer();
|
2016-01-06 15:15:25 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2016-01-06 15:41:38 +01:00
|
|
|
$repository = $drequest->getRepository();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$revision_map = array();
|
|
|
|
$revisions = array();
|
|
|
|
if ($blame_commits) {
|
|
|
|
$commit_map = mpull($blame_commits, 'getCommitIdentifier', 'getPHID');
|
|
|
|
|
|
|
|
$revision_ids = id(new DifferentialRevision())
|
|
|
|
->loadIDsByCommitPHIDs(array_keys($commit_map));
|
|
|
|
if ($revision_ids) {
|
|
|
|
$revisions = id(new DifferentialRevisionQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs($revision_ids)
|
|
|
|
->execute();
|
|
|
|
$revisions = mpull($revisions, null, 'getID');
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($revision_ids as $commit_phid => $revision_id) {
|
2018-01-19 22:38:23 +01:00
|
|
|
// If the viewer can't actually see this revision, skip it.
|
|
|
|
if (!isset($revisions[$revision_id])) {
|
|
|
|
continue;
|
|
|
|
}
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$revision_map[$commit_map[$commit_phid]] = $revision_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$phids = array();
|
|
|
|
foreach ($blame_commits as $commit) {
|
|
|
|
$author_phid = $commit->getAuthorPHID();
|
|
|
|
if ($author_phid === null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$phids[$author_phid] = $author_phid;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($revisions as $revision) {
|
|
|
|
$author_phid = $revision->getAuthorPHID();
|
|
|
|
if ($author_phid === null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$phids[$author_phid] = $author_phid;
|
|
|
|
}
|
|
|
|
|
|
|
|
$handles = $viewer->loadHandles($phids);
|
|
|
|
|
2017-10-31 19:28:31 +01:00
|
|
|
$author_phids = array();
|
|
|
|
$author_map = array();
|
|
|
|
foreach ($blame_commits as $commit) {
|
|
|
|
$commit_identifier = $commit->getCommitIdentifier();
|
|
|
|
|
|
|
|
$author_phid = '';
|
|
|
|
if (isset($revision_map[$commit_identifier])) {
|
|
|
|
$revision_id = $revision_map[$commit_identifier];
|
|
|
|
$revision = $revisions[$revision_id];
|
|
|
|
$author_phid = $revision->getAuthorPHID();
|
|
|
|
} else {
|
|
|
|
$author_phid = $commit->getAuthorPHID();
|
|
|
|
}
|
|
|
|
|
|
|
|
$author_map[$commit_identifier] = $author_phid;
|
|
|
|
$author_phids[$author_phid] = $author_phid;
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$colors = array();
|
|
|
|
if ($blame_commits) {
|
|
|
|
$epochs = array();
|
|
|
|
|
|
|
|
foreach ($blame_commits as $identifier => $commit) {
|
|
|
|
$epochs[$identifier] = $commit->getEpoch();
|
|
|
|
}
|
|
|
|
|
|
|
|
$epoch_list = array_filter($epochs);
|
2016-01-06 15:15:25 +01:00
|
|
|
$epoch_list = array_unique($epoch_list);
|
|
|
|
$epoch_list = array_values($epoch_list);
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$epoch_min = min($epoch_list);
|
|
|
|
$epoch_max = max($epoch_list);
|
|
|
|
$epoch_range = ($epoch_max - $epoch_min) + 1;
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
|
|
|
|
foreach ($blame_commits as $identifier => $commit) {
|
|
|
|
$epoch = $epochs[$identifier];
|
|
|
|
if (!$epoch) {
|
|
|
|
$color = '#ffffdd'; // Warning color, missing data.
|
|
|
|
} else {
|
|
|
|
$color_ratio = ($epoch - $epoch_min) / $epoch_range;
|
|
|
|
$color_value = 0xE6 * (1.0 - $color_ratio);
|
|
|
|
$color = sprintf(
|
|
|
|
'#%02x%02x%02x',
|
|
|
|
$color_value,
|
|
|
|
0xF6,
|
|
|
|
$color_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
$colors[$identifier] = $color;
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$display = array();
|
|
|
|
$last_identifier = null;
|
|
|
|
$last_color = null;
|
|
|
|
foreach ($lines as $line_index => $line) {
|
|
|
|
$color = '#f6f6f6';
|
|
|
|
$duplicate = false;
|
|
|
|
if (isset($blame_list[$line_index])) {
|
|
|
|
$identifier = $blame_list[$line_index];
|
|
|
|
if (isset($colors[$identifier])) {
|
|
|
|
$color = $colors[$identifier];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($identifier === $last_identifier) {
|
|
|
|
$duplicate = true;
|
|
|
|
} else {
|
|
|
|
$last_identifier = $identifier;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$display[$line_index] = array(
|
|
|
|
'data' => $line,
|
|
|
|
'target' => false,
|
|
|
|
'highlighted' => false,
|
|
|
|
'color' => $color,
|
|
|
|
'duplicate' => $duplicate,
|
|
|
|
);
|
|
|
|
}
|
2016-01-06 15:15:25 +01:00
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$line_arr = array();
|
|
|
|
$line_str = $drequest->getLine();
|
|
|
|
$ranges = explode(',', $line_str);
|
|
|
|
foreach ($ranges as $range) {
|
|
|
|
if (strpos($range, '-') !== false) {
|
|
|
|
list($min, $max) = explode('-', $range, 2);
|
|
|
|
$line_arr[] = array(
|
|
|
|
'min' => min($min, $max),
|
|
|
|
'max' => max($min, $max),
|
|
|
|
);
|
|
|
|
} else if (strlen($range)) {
|
|
|
|
$line_arr[] = array(
|
|
|
|
'min' => $range,
|
|
|
|
'max' => $range,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
// Mark the first highlighted line as the target line.
|
|
|
|
if ($line_arr) {
|
|
|
|
$target_line = $line_arr[0]['min'];
|
|
|
|
if (isset($display[$target_line - 1])) {
|
|
|
|
$display[$target_line - 1]['target'] = true;
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
// Mark all other highlighted lines as highlighted.
|
|
|
|
foreach ($line_arr as $range) {
|
|
|
|
for ($ii = $range['min']; $ii <= $range['max']; $ii++) {
|
|
|
|
if (isset($display[$ii - 1])) {
|
|
|
|
$display[$ii - 1]['highlighted'] = true;
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$engine = null;
|
|
|
|
$inlines = array();
|
|
|
|
if ($this->getRequest()->getStr('lint') !== null && $this->lintMessages) {
|
|
|
|
$engine = new PhabricatorMarkupEngine();
|
|
|
|
$engine->setViewer($viewer);
|
|
|
|
|
|
|
|
foreach ($this->lintMessages as $message) {
|
|
|
|
$inline = id(new PhabricatorAuditInlineComment())
|
|
|
|
->setSyntheticAuthor(
|
|
|
|
ArcanistLintSeverity::getStringForSeverity($message['severity']).
|
|
|
|
' '.$message['code'].' ('.$message['name'].')')
|
|
|
|
->setLineNumber($message['line'])
|
|
|
|
->setContent($message['description']);
|
|
|
|
$inlines[$message['line']][] = $inline;
|
|
|
|
|
|
|
|
$engine->addObject(
|
|
|
|
$inline,
|
|
|
|
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
|
|
|
|
}
|
|
|
|
|
|
|
|
$engine->process();
|
|
|
|
require_celerity_resource('differential-changeset-view-css');
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows = $this->renderInlines(
|
|
|
|
idx($inlines, 0, array()),
|
|
|
|
$show_blame,
|
|
|
|
(bool)$this->coverage,
|
|
|
|
$engine);
|
|
|
|
|
2016-01-06 15:41:38 +01:00
|
|
|
// NOTE: We're doing this manually because rendering is otherwise
|
|
|
|
// dominated by URI generation for very large files.
|
2018-03-07 16:02:34 +01:00
|
|
|
$line_base = $this->getLineNumberBaseURI();
|
2016-01-06 15:41:38 +01:00
|
|
|
|
|
|
|
require_celerity_resource('aphront-tooltip-css');
|
|
|
|
Javelin::initBehavior('phabricator-oncopy');
|
|
|
|
Javelin::initBehavior('phabricator-tooltips');
|
|
|
|
Javelin::initBehavior('phabricator-line-linker');
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
// Render these once, since they tend to get repeated many times in large
|
|
|
|
// blame outputs.
|
|
|
|
$commit_links = $this->renderCommitLinks($blame_commits, $handles);
|
|
|
|
$revision_links = $this->renderRevisionLinks($revisions, $handles);
|
2017-10-31 19:28:31 +01:00
|
|
|
$author_links = $this->renderAuthorLinks($author_map, $handles);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-04-15 14:37:58 +02:00
|
|
|
if ($this->coverage) {
|
|
|
|
require_celerity_resource('differential-changeset-view-css');
|
|
|
|
Javelin::initBehavior(
|
|
|
|
'diffusion-browse-file',
|
|
|
|
array(
|
|
|
|
'labels' => array(
|
|
|
|
'cov-C' => pht('Covered'),
|
|
|
|
'cov-N' => pht('Not Covered'),
|
|
|
|
'cov-U' => pht('Not Executable'),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$skip_text = pht('Skip Past This Commit');
|
|
|
|
$skip_icon = id(new PHUIIconView())
|
|
|
|
->setIcon('fa-caret-square-o-left');
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
foreach ($display as $line_index => $line) {
|
|
|
|
$row = array();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$line_number = $line_index + 1;
|
|
|
|
$line_href = $line_base.'$'.$line_number;
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
if (isset($blame_list[$line_index])) {
|
|
|
|
$identifier = $blame_list[$line_index];
|
|
|
|
} else {
|
|
|
|
$identifier = null;
|
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$revision_link = null;
|
|
|
|
$commit_link = null;
|
2017-10-31 19:28:31 +01:00
|
|
|
$author_link = null;
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$before_link = null;
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$style = 'background: '.$line['color'].';';
|
2016-01-28 20:10:01 +01:00
|
|
|
|
|
|
|
if ($identifier && !$line['duplicate']) {
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
if (isset($commit_links[$identifier])) {
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$commit_link = $commit_links[$identifier];
|
2017-10-31 19:28:31 +01:00
|
|
|
$author_link = $author_links[$author_map[$identifier]];
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
if (isset($revision_map[$identifier])) {
|
|
|
|
$revision_id = $revision_map[$identifier];
|
|
|
|
if (isset($revision_links[$revision_id])) {
|
|
|
|
$revision_link = $revision_links[$revision_id];
|
2016-01-06 15:41:38 +01:00
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$skip_href = $line_href.'?before='.$identifier.'&view=blame';
|
|
|
|
$before_link = javelin_tag(
|
|
|
|
'a',
|
2016-01-05 14:18:59 +01:00
|
|
|
array(
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
'href' => $skip_href,
|
|
|
|
'sigil' => 'has-tooltip',
|
|
|
|
'meta' => array(
|
|
|
|
'tip' => $skip_text,
|
|
|
|
'align' => 'E',
|
|
|
|
'size' => 300,
|
|
|
|
),
|
2016-01-05 14:18:59 +01:00
|
|
|
),
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$skip_icon);
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
}
|
2016-01-05 14:18:59 +01:00
|
|
|
|
2016-03-26 19:51:47 +01:00
|
|
|
if ($show_blame) {
|
|
|
|
$row[] = phutil_tag(
|
|
|
|
'th',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-blame-link',
|
|
|
|
),
|
|
|
|
$before_link);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$object_links = array();
|
2017-10-31 19:28:31 +01:00
|
|
|
$object_links[] = $author_link;
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$object_links[] = $commit_link;
|
|
|
|
if ($revision_link) {
|
|
|
|
$object_links[] = phutil_tag('span', array(), '/');
|
|
|
|
$object_links[] = $revision_link;
|
2017-08-25 04:36:33 +02:00
|
|
|
}
|
2017-08-23 17:44:04 +02:00
|
|
|
|
|
|
|
$row[] = phutil_tag(
|
|
|
|
'th',
|
|
|
|
array(
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
'class' => 'diffusion-rev-link',
|
2017-08-23 17:44:04 +02:00
|
|
|
),
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$object_links);
|
2016-03-26 19:51:47 +01:00
|
|
|
}
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$line_link = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $line_href,
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
'style' => $style,
|
2016-01-05 14:18:59 +01:00
|
|
|
),
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$line_number);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$row[] = javelin_tag(
|
2016-01-05 14:18:59 +01:00
|
|
|
'th',
|
|
|
|
array(
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
'class' => 'diffusion-line-link',
|
2016-01-05 14:18:59 +01:00
|
|
|
'sigil' => 'phabricator-source-line',
|
|
|
|
'style' => $style,
|
|
|
|
),
|
|
|
|
$line_link);
|
|
|
|
|
|
|
|
if ($line['target']) {
|
|
|
|
Javelin::initBehavior(
|
|
|
|
'diffusion-jump-to',
|
|
|
|
array(
|
|
|
|
'target' => 'scroll_target',
|
|
|
|
));
|
|
|
|
$anchor_text = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'id' => 'scroll_target',
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
} else {
|
|
|
|
$anchor_text = null;
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$row[] = phutil_tag(
|
2016-01-05 14:18:59 +01:00
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$anchor_text,
|
|
|
|
|
|
|
|
// NOTE: See phabricator-oncopy behavior.
|
|
|
|
"\xE2\x80\x8B",
|
|
|
|
|
|
|
|
// TODO: [HTML] Not ideal.
|
|
|
|
phutil_safe_html(str_replace("\t", ' ', $line['data'])),
|
|
|
|
));
|
|
|
|
|
|
|
|
if ($this->coverage) {
|
2016-02-01 20:04:28 +01:00
|
|
|
$cov_index = $line_index;
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
if (isset($this->coverage[$cov_index])) {
|
|
|
|
$cov_class = $this->coverage[$cov_index];
|
|
|
|
} else {
|
|
|
|
$cov_class = 'N';
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$row[] = phutil_tag(
|
2016-01-05 14:18:59 +01:00
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
'class' => 'cov cov-'.$cov_class,
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows[] = phutil_tag(
|
|
|
|
'tr',
|
|
|
|
array(
|
|
|
|
'class' => ($line['highlighted'] ?
|
|
|
|
'phabricator-source-highlight' :
|
|
|
|
null),
|
|
|
|
),
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
$row);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$cur_inlines = $this->renderInlines(
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
idx($inlines, $line_number, array()),
|
2016-01-05 14:18:59 +01:00
|
|
|
$show_blame,
|
|
|
|
$this->coverage,
|
|
|
|
$engine);
|
|
|
|
foreach ($cur_inlines as $cur_inline) {
|
|
|
|
$rows[] = $cur_inline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $rows;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderInlines(
|
|
|
|
array $inlines,
|
2016-01-06 15:15:25 +01:00
|
|
|
$show_blame,
|
2016-01-05 14:18:59 +01:00
|
|
|
$has_coverage,
|
|
|
|
$engine) {
|
|
|
|
|
|
|
|
$rows = array();
|
|
|
|
foreach ($inlines as $inline) {
|
|
|
|
|
|
|
|
// TODO: This should use modern scaffolding code.
|
|
|
|
|
|
|
|
$inline_view = id(new PHUIDiffInlineCommentDetailView())
|
|
|
|
->setUser($this->getViewer())
|
|
|
|
->setMarkupEngine($engine)
|
|
|
|
->setInlineComment($inline)
|
|
|
|
->render();
|
|
|
|
|
2016-01-06 15:15:25 +01:00
|
|
|
$row = array_fill(0, ($show_blame ? 3 : 1), phutil_tag('th'));
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$row[] = phutil_tag('td', array(), $inline_view);
|
|
|
|
|
|
|
|
if ($has_coverage) {
|
|
|
|
$row[] = phutil_tag(
|
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
'class' => 'cov cov-I',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows[] = phutil_tag('tr', array('class' => 'inline'), $row);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $rows;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildImageCorpus($file_uri) {
|
|
|
|
$properties = new PHUIPropertyListView();
|
|
|
|
|
|
|
|
$properties->addImageContent(
|
|
|
|
phutil_tag(
|
|
|
|
'img',
|
|
|
|
array(
|
|
|
|
'src' => $file_uri,
|
|
|
|
)));
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $this->renderFileButton($file_uri);
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$title = basename($this->getDiffusionRequest()->getPath());
|
|
|
|
$icon = 'fa-file-image-o';
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->buildActionButtons($drequest);
|
|
|
|
$header = $this->buildPanelHeaderView($title, $icon);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
return id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
2016-03-17 20:01:22 +01:00
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2016-01-05 14:18:59 +01:00
|
|
|
->addPropertyList($properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildBinaryCorpus($file_uri, $data) {
|
|
|
|
$size = new PhutilNumber(strlen($data));
|
|
|
|
$text = pht('This is a binary file. It is %s byte(s) in length.', $size);
|
|
|
|
$text = id(new PHUIBoxView())
|
|
|
|
->addPadding(PHUI::PADDING_LARGE)
|
|
|
|
->appendChild($text);
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $this->renderFileButton($file_uri);
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$title = basename($this->getDiffusionRequest()->getPath());
|
|
|
|
$icon = 'fa-file';
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->buildActionButtons($drequest);
|
|
|
|
$header = $this->buildPanelHeaderView($title, $icon);
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
2016-03-17 20:01:22 +01:00
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2016-01-05 14:18:59 +01:00
|
|
|
->appendChild($text);
|
|
|
|
|
|
|
|
return $box;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildErrorCorpus($message) {
|
|
|
|
$text = id(new PHUIBoxView())
|
|
|
|
->addPadding(PHUI::PADDING_LARGE)
|
|
|
|
->appendChild($message);
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
2016-04-07 00:20:53 +02:00
|
|
|
->setHeader(pht('Details'));
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->appendChild($text);
|
|
|
|
|
|
|
|
return $box;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildBeforeResponse($before) {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
|
|
|
// NOTE: We need to get the grandparent so we can capture filename changes
|
|
|
|
// in the parent.
|
|
|
|
|
|
|
|
$parent = $this->loadParentCommitOf($before);
|
|
|
|
$old_filename = null;
|
|
|
|
$was_created = false;
|
|
|
|
if ($parent) {
|
|
|
|
$grandparent = $this->loadParentCommitOf($parent);
|
|
|
|
|
|
|
|
if ($grandparent) {
|
|
|
|
$rename_query = new DiffusionRenameHistoryQuery();
|
|
|
|
$rename_query->setRequest($drequest);
|
|
|
|
$rename_query->setOldCommit($grandparent);
|
|
|
|
$rename_query->setViewer($request->getUser());
|
|
|
|
$old_filename = $rename_query->loadOldFilename();
|
|
|
|
$was_created = $rename_query->getWasCreated();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$follow = null;
|
|
|
|
if ($was_created) {
|
|
|
|
// If the file was created in history, that means older commits won't
|
|
|
|
// have it. Since we know it existed at 'before', it must have been
|
|
|
|
// created then; jump there.
|
|
|
|
$target_commit = $before;
|
|
|
|
$follow = 'created';
|
|
|
|
} else if ($parent) {
|
|
|
|
// If we found a parent, jump to it. This is the normal case.
|
|
|
|
$target_commit = $parent;
|
|
|
|
} else {
|
|
|
|
// If there's no parent, this was probably created in the initial commit?
|
|
|
|
// And the "was_created" check will fail because we can't identify the
|
|
|
|
// grandparent. Keep the user at 'before'.
|
|
|
|
$target_commit = $before;
|
|
|
|
$follow = 'first';
|
|
|
|
}
|
|
|
|
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
$renamed = null;
|
|
|
|
if ($old_filename !== null &&
|
|
|
|
$old_filename !== '/'.$path) {
|
|
|
|
$renamed = $path;
|
|
|
|
$path = $old_filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
$line = null;
|
|
|
|
// If there's a follow error, drop the line so the user sees the message.
|
|
|
|
if (!$follow) {
|
|
|
|
$line = $this->getBeforeLineNumber($target_commit);
|
|
|
|
}
|
|
|
|
|
|
|
|
$before_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'commit' => $target_commit,
|
|
|
|
'line' => $line,
|
|
|
|
'path' => $path,
|
|
|
|
));
|
|
|
|
|
|
|
|
$before_uri->setQueryParams($request->getRequestURI()->getQueryParams());
|
|
|
|
$before_uri = $before_uri->alter('before', null);
|
|
|
|
$before_uri = $before_uri->alter('renamed', $renamed);
|
|
|
|
$before_uri = $before_uri->alter('follow', $follow);
|
|
|
|
|
|
|
|
return id(new AphrontRedirectResponse())->setURI($before_uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getBeforeLineNumber($target_commit) {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2016-08-26 18:37:53 +02:00
|
|
|
$viewer = $this->getViewer();
|
2016-01-05 14:18:59 +01:00
|
|
|
|
|
|
|
$line = $drequest->getLine();
|
|
|
|
if (!$line) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-08-26 18:37:53 +02:00
|
|
|
$diff_info = $this->callConduitWithDiffusionRequest(
|
2016-01-05 14:18:59 +01:00
|
|
|
'diffusion.rawdiffquery',
|
|
|
|
array(
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'againstCommit' => $target_commit,
|
|
|
|
));
|
2016-08-26 18:37:53 +02:00
|
|
|
|
|
|
|
$file_phid = $diff_info['filePHID'];
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withPHIDs(array($file_phid))
|
|
|
|
->executeOne();
|
|
|
|
if (!$file) {
|
|
|
|
throw new Exception(
|
|
|
|
pht(
|
|
|
|
'Failed to load file ("%s") returned by "%s".',
|
|
|
|
$file_phid,
|
|
|
|
'diffusion.rawdiffquery.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$raw_diff = $file->loadFileData();
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
$old_line = 0;
|
|
|
|
$new_line = 0;
|
|
|
|
|
|
|
|
foreach (explode("\n", $raw_diff) as $text) {
|
|
|
|
if ($text[0] == '-' || $text[0] == ' ') {
|
|
|
|
$old_line++;
|
|
|
|
}
|
|
|
|
if ($text[0] == '+' || $text[0] == ' ') {
|
|
|
|
$new_line++;
|
|
|
|
}
|
|
|
|
if ($new_line == $line) {
|
|
|
|
return $old_line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// We didn't find the target line.
|
|
|
|
return $line;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function loadParentCommitOf($commit) {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$before_req = DiffusionRequest::newFromDictionary(
|
|
|
|
array(
|
|
|
|
'user' => $user,
|
|
|
|
'repository' => $drequest->getRepository(),
|
|
|
|
'commit' => $commit,
|
|
|
|
));
|
|
|
|
|
|
|
|
$parents = DiffusionQuery::callConduitWithDiffusionRequest(
|
|
|
|
$user,
|
|
|
|
$before_req,
|
|
|
|
'diffusion.commitparentsquery',
|
|
|
|
array(
|
|
|
|
'commit' => $commit,
|
|
|
|
));
|
|
|
|
|
|
|
|
return head($parents);
|
|
|
|
}
|
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
private function renderRevisionTooltip(
|
|
|
|
DifferentialRevision $revision,
|
|
|
|
$handles) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$date = phabricator_date($revision->getDateModified(), $viewer);
|
|
|
|
$id = $revision->getID();
|
|
|
|
$title = $revision->getTitle();
|
|
|
|
$header = "D{$id} {$title}";
|
|
|
|
|
|
|
|
$author = $handles[$revision->getAuthorPHID()]->getName();
|
|
|
|
|
|
|
|
return "{$header}\n{$date} \xC2\xB7 {$author}";
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderCommitTooltip(
|
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
$author) {
|
|
|
|
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$date = phabricator_date($commit->getEpoch(), $viewer);
|
|
|
|
$summary = trim($commit->getSummary());
|
|
|
|
|
|
|
|
return "{$summary}\n{$date} \xC2\xB7 {$author}";
|
|
|
|
}
|
|
|
|
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
protected function markupText($text) {
|
2012-04-24 03:36:25 +02:00
|
|
|
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
2013-03-04 21:33:05 +01:00
|
|
|
$engine->setConfig('viewer', $this->getRequest()->getUser());
|
2013-02-13 23:50:15 +01:00
|
|
|
$text = $engine->markupText($text);
|
2012-04-24 03:36:25 +02:00
|
|
|
|
2013-01-18 09:32:58 +01:00
|
|
|
$text = phutil_tag(
|
2012-04-24 03:36:25 +02:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-remarkup',
|
|
|
|
),
|
|
|
|
$text);
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
protected function buildHeaderView(DiffusionRequest $drequest) {
|
2016-03-17 20:01:22 +01:00
|
|
|
$viewer = $this->getViewer();
|
2017-08-16 21:07:14 +02:00
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$commit_tag = $this->renderCommitHashTag($drequest);
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-09-29 23:48:38 +02:00
|
|
|
$path = nonempty($drequest->getPath(), '/');
|
|
|
|
|
2017-08-15 23:14:08 +02:00
|
|
|
$search = $this->renderSearchForm($path);
|
2013-09-19 20:57:33 +02:00
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setUser($viewer)
|
2013-09-23 21:55:23 +02:00
|
|
|
->setHeader($this->renderPathLinks($drequest, $mode = 'browse'))
|
2017-08-15 01:29:27 +02:00
|
|
|
->addActionItem($search)
|
2017-08-16 21:07:14 +02:00
|
|
|
->addTag($commit_tag)
|
2017-08-15 01:29:27 +02:00
|
|
|
->addClass('diffusion-browse-header');
|
2013-09-19 20:57:33 +02:00
|
|
|
|
2017-08-16 21:07:14 +02:00
|
|
|
if (!$repository->isSVN()) {
|
|
|
|
$branch_tag = $this->renderBranchTag($drequest);
|
|
|
|
$header->addTag($branch_tag);
|
|
|
|
}
|
|
|
|
|
2013-09-19 20:57:33 +02:00
|
|
|
return $header;
|
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
protected function buildPanelHeaderView($title, $icon) {
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader($title)
|
|
|
|
->setHeaderIcon($icon)
|
|
|
|
->addClass('diffusion-panel-header-view');
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
return $header;
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
}
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
protected function buildActionButtons(
|
|
|
|
DiffusionRequest $drequest,
|
|
|
|
$is_directory = false) {
|
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$history_uri = $drequest->generateURI(array('action' => 'history'));
|
2014-05-13 22:52:48 +02:00
|
|
|
$behind_head = $drequest->getSymbolicCommit();
|
2017-07-09 15:40:51 +02:00
|
|
|
$compare = null;
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
$head_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'commit' => '',
|
|
|
|
'action' => 'browse',
|
|
|
|
));
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
if ($repository->supportsBranchComparison() && $is_directory) {
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$compare_uri = $drequest->generateURI(array('action' => 'compare'));
|
|
|
|
$compare = id(new PHUIButtonView())
|
|
|
|
->setText(pht('Compare'))
|
|
|
|
->setIcon('fa-code-fork')
|
|
|
|
->setWorkflow(true)
|
|
|
|
->setTag('a')
|
|
|
|
->setHref($compare_uri)
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $compare;
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$head = null;
|
|
|
|
if ($behind_head) {
|
|
|
|
$head = id(new PHUIButtonView())
|
2017-08-22 03:47:27 +02:00
|
|
|
->setTag('a')
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
->setText(pht('Back to HEAD'))
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
->setHref($head_uri)
|
2014-05-12 19:08:32 +02:00
|
|
|
->setIcon('fa-home')
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
->setColor(PHUIButtonView::GREY);
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $head;
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
}
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$history = id(new PHUIButtonView())
|
|
|
|
->setText(pht('History'))
|
|
|
|
->setHref($history_uri)
|
|
|
|
->setTag('a')
|
|
|
|
->setIcon('fa-history')
|
|
|
|
->setColor(PHUIButtonView::GREY);
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $history;
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
}
|
|
|
|
|
2013-10-11 16:53:56 +02:00
|
|
|
protected function buildPropertyView(
|
2016-03-17 20:01:22 +01:00
|
|
|
DiffusionRequest $drequest) {
|
2013-10-11 16:53:56 +02:00
|
|
|
|
2015-08-15 22:06:10 +02:00
|
|
|
$viewer = $this->getViewer();
|
2013-10-11 16:53:56 +02:00
|
|
|
$view = id(new PHUIPropertyListView())
|
2016-03-17 20:01:22 +01:00
|
|
|
->setUser($viewer);
|
2013-09-19 20:57:33 +02:00
|
|
|
|
2014-05-13 22:52:03 +02:00
|
|
|
if ($drequest->getSymbolicType() == 'tag') {
|
2013-11-04 21:16:53 +01:00
|
|
|
$symbolic = $drequest->getSymbolicCommit();
|
|
|
|
$view->addProperty(pht('Tag'), $symbolic);
|
2013-09-19 20:57:33 +02:00
|
|
|
|
2013-11-04 21:16:53 +01:00
|
|
|
$tags = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.tagsquery',
|
|
|
|
array(
|
|
|
|
'names' => array($symbolic),
|
|
|
|
'needMessages' => true,
|
|
|
|
));
|
|
|
|
$tags = DiffusionRepositoryTag::newFromConduit($tags);
|
|
|
|
|
|
|
|
$tags = mpull($tags, null, 'getName');
|
|
|
|
$tag = idx($tags, $symbolic);
|
|
|
|
|
|
|
|
if ($tag && strlen($tag->getMessage())) {
|
2015-09-19 20:29:01 +02:00
|
|
|
$view->addSectionHeader(
|
|
|
|
pht('Tag Content'), 'fa-tag');
|
2013-11-04 21:16:53 +01:00
|
|
|
$view->addTextContent($this->markupText($tag->getMessage()));
|
|
|
|
}
|
2013-09-19 20:57:33 +02:00
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
if ($view->hasAnyProperties()) {
|
|
|
|
return $view;
|
2015-08-15 22:06:10 +02:00
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
return null;
|
2013-09-19 20:57:33 +02:00
|
|
|
}
|
|
|
|
|
2016-01-05 14:18:59 +01:00
|
|
|
private function buildOpenRevisions() {
|
|
|
|
$viewer = $this->getViewer();
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
|
|
|
|
$path_map = id(new DiffusionPathIDQuery(array($path)))->loadPathIDs();
|
|
|
|
$path_id = idx($path_map, $path);
|
|
|
|
if (!$path_id) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-03-25 18:21:56 +01:00
|
|
|
$recent = (PhabricatorTime::getNow() - phutil_units('30 days in seconds'));
|
|
|
|
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
$revisions = id(new DifferentialRevisionQuery())
|
2016-01-05 14:18:59 +01:00
|
|
|
->setViewer($viewer)
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
->withPath($repository->getID(), $path_id)
|
2017-08-11 18:18:47 +02:00
|
|
|
->withIsOpen(true)
|
2015-03-25 18:21:56 +01:00
|
|
|
->withUpdatedEpochBetween($recent, null)
|
2015-04-12 05:16:52 +02:00
|
|
|
->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
->setLimit(10)
|
2017-03-20 22:37:24 +01:00
|
|
|
->needReviewers(true)
|
2014-02-19 02:57:45 +01:00
|
|
|
->needFlags(true)
|
|
|
|
->needDrafts(true)
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
->execute();
|
|
|
|
|
|
|
|
if (!$revisions) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-03-25 18:21:56 +01:00
|
|
|
$header = id(new PHUIHeaderView())
|
2017-07-09 15:40:51 +02:00
|
|
|
->setHeader(pht('Recently Open Revisions'));
|
2015-03-25 18:21:56 +01:00
|
|
|
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
$list = id(new DifferentialRevisionListView())
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
->setRevisions($revisions)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->setUser($viewer)
|
|
|
|
->setNoBox(true);
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
$phids = $list->getRequiredHandlePHIDs();
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
$list->setHandles($handles);
|
|
|
|
|
|
|
|
$view = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
|
|
->addClass('diffusion-mobile-view')
|
|
|
|
->appendChild($list);
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
|
2015-02-19 17:11:17 +01:00
|
|
|
return $view;
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
}
|
|
|
|
|
2016-01-07 03:08:07 +01:00
|
|
|
private function loadBlame($path, $commit, $timeout) {
|
2016-01-06 15:15:25 +01:00
|
|
|
$blame = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.blame',
|
|
|
|
array(
|
|
|
|
'commit' => $commit,
|
|
|
|
'paths' => array($path),
|
2016-01-07 03:08:07 +01:00
|
|
|
'timeout' => $timeout,
|
2016-01-06 15:15:25 +01:00
|
|
|
));
|
|
|
|
|
2016-01-07 03:08:07 +01:00
|
|
|
$identifiers = idx($blame, $path, null);
|
2016-01-06 15:15:25 +01:00
|
|
|
|
|
|
|
if ($identifiers) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$commits = id(new DiffusionCommitQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withRepository($repository)
|
|
|
|
->withIdentifiers($identifiers)
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
// TODO: We only fetch this to improve author display behavior, but
|
|
|
|
// shouldn't really need to?
|
|
|
|
->needCommitData(true)
|
2016-01-06 15:15:25 +01:00
|
|
|
->execute();
|
|
|
|
$commits = mpull($commits, null, 'getCommitIdentifier');
|
|
|
|
} else {
|
|
|
|
$commits = array();
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
return array($identifiers, $commits);
|
|
|
|
}
|
|
|
|
|
2017-10-31 19:28:31 +01:00
|
|
|
private function renderAuthorLinks(array $authors, $handles) {
|
|
|
|
$links = array();
|
|
|
|
|
|
|
|
foreach ($authors as $phid) {
|
|
|
|
if (!strlen($phid)) {
|
|
|
|
// This means we couldn't identify an author for the commit or the
|
|
|
|
// revision. We just render a blank for alignment.
|
|
|
|
$style = null;
|
|
|
|
$href = null;
|
2017-12-18 15:26:38 +01:00
|
|
|
$sigil = null;
|
|
|
|
$meta = null;
|
2017-10-31 19:28:31 +01:00
|
|
|
} else {
|
|
|
|
$src = $handles[$phid]->getImageURI();
|
|
|
|
$style = 'background-image: url('.$src.');';
|
|
|
|
$href = $handles[$phid]->getURI();
|
2017-12-18 15:26:38 +01:00
|
|
|
$sigil = 'has-tooltip';
|
|
|
|
$meta = array(
|
|
|
|
'tip' => $handles[$phid]->getName(),
|
|
|
|
'align' => 'E',
|
|
|
|
);
|
2017-10-31 19:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$links[$phid] = javelin_tag(
|
|
|
|
$href ? 'a' : 'span',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-author-link',
|
|
|
|
'style' => $style,
|
|
|
|
'href' => $href,
|
2017-12-18 15:26:38 +01:00
|
|
|
'sigil' => $sigil,
|
|
|
|
'meta' => $meta,
|
2017-10-31 19:28:31 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $links;
|
|
|
|
}
|
|
|
|
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
private function renderCommitLinks(array $commits, $handles) {
|
|
|
|
$links = array();
|
|
|
|
foreach ($commits as $identifier => $commit) {
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$tooltip = $this->renderCommitTooltip(
|
|
|
|
$commit,
|
|
|
|
$commit->renderAuthorShortName($handles));
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$commit_link = javelin_tag(
|
2017-08-23 17:44:04 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $commit->getURI(),
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
'sigil' => 'has-tooltip',
|
|
|
|
'meta' => array(
|
|
|
|
'tip' => $tooltip,
|
|
|
|
'align' => 'E',
|
|
|
|
'size' => 600,
|
|
|
|
),
|
2017-08-23 17:44:04 +02:00
|
|
|
),
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$commit->getLocalName());
|
2017-08-23 17:44:04 +02:00
|
|
|
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
$links[$identifier] = $commit_link;
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $links;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderRevisionLinks(array $revisions, $handles) {
|
|
|
|
$links = array();
|
|
|
|
|
|
|
|
foreach ($revisions as $revision) {
|
|
|
|
$revision_id = $revision->getID();
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
|
|
|
|
$tooltip = $this->renderRevisionTooltip($revision, $handles);
|
|
|
|
|
|
|
|
$revision_link = javelin_tag(
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
'a',
|
|
|
|
array(
|
2016-01-07 03:52:13 +01:00
|
|
|
'href' => '/'.$revision->getMonogram(),
|
Revert changes to Diffusion blame view
Summary:
Ref PHI174. This reverts most of these changes:
- 37843127e94a878a7f5bf2c65c8e7004bc65c68a / D18481
- 94cad30ac3f052a711ececf7e370bf5c0071827f / D18474
- 12ae08b6b1a1b7c330593e76c32817f7cdbc87dd / D18473
- 0a013341721f8b1fc249047fe6db26062138b562 / D18462
- ac91ab1ef9196eee0deabfd70157ccc0d53d666e / D18452
These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes.
I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has.
In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized.
I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit".
I'm going to follow this up with some additional changes:
- Show a small author profile icon, similar to GitHub, to address PHI174 more directly.
- Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end.
- Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct.
- Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands.
Test Plan:
Viewed blame views in Diffusion, saw a more compact UI similar to the old UI.
{F5251019}
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18746
2017-10-31 18:49:19 +01:00
|
|
|
'sigil' => 'has-tooltip',
|
|
|
|
'meta' => array(
|
|
|
|
'tip' => $tooltip,
|
|
|
|
'align' => 'E',
|
|
|
|
'size' => 600,
|
|
|
|
),
|
Make mundane performance improvements to Diffusion browse views
Summary:
Ref T2450. This reorganizes code to improve performance.
Mostly, there are a lot of things which are unique per commit (author name, links, short name, etc), but we were rendering them for every line.
This often meant we'd render the same author's name thousands of times. This is slower than rendering it only once.
In 99% of interfaces this doesn't matter, but blame is weird and it's significant on big files.
Test Plan:
Locally, `__phutil_library_map__.php` now has costs of roughly:
- 550ms for main content (from 650ms before the patch).
- 1,500ms for blame content (frrom 1,800ms before the patch).
So this isn't huge, is a decent ~20%-ish performance gain for shuffling some stuff around.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T2450
Differential Revision: https://secure.phabricator.com/D14963
2016-01-07 02:59:06 +01:00
|
|
|
),
|
|
|
|
$revision->getMonogram());
|
|
|
|
|
|
|
|
$links[$revision_id] = $revision_link;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $links;
|
|
|
|
}
|
|
|
|
|
2016-03-18 16:13:20 +01:00
|
|
|
private function getGitLFSRef(PhabricatorRepository $repository, $data) {
|
|
|
|
if (!$repository->canUseGitLFS()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$lfs_pattern = '(^version https://git-lfs\\.github\\.com/spec/v1[\r\n])';
|
|
|
|
if (!preg_match($lfs_pattern, $data)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$matches = null;
|
|
|
|
if (!preg_match('(^oid sha256:(.*)$)m', $data, $matches)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$hash = $matches[1];
|
|
|
|
$hash = trim($hash);
|
|
|
|
|
|
|
|
return id(new PhabricatorRepositoryGitLFSRefQuery())
|
|
|
|
->setViewer($this->getViewer())
|
|
|
|
->withRepositoryPHIDs(array($repository->getPHID()))
|
|
|
|
->withObjectHashes(array($hash))
|
|
|
|
->executeOne();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildGitLFSCorpus(PhabricatorRepositoryGitLFSRef $ref) {
|
|
|
|
// TODO: We should probably test if we can load the file PHID here and
|
|
|
|
// show the user an error if we can't, rather than making them click
|
|
|
|
// through to hit an error.
|
|
|
|
|
Move Diffusion Browse to a single column layout
Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.
Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17766
2017-07-01 17:38:17 +02:00
|
|
|
$title = basename($this->getDiffusionRequest()->getPath());
|
|
|
|
$icon = 'fa-archive';
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->buildActionButtons($drequest);
|
|
|
|
$header = $this->buildPanelHeaderView($title, $icon);
|
2016-03-18 16:13:20 +01:00
|
|
|
|
|
|
|
$severity = PHUIInfoView::SEVERITY_NOTICE;
|
|
|
|
|
|
|
|
$messages = array();
|
|
|
|
$messages[] = pht(
|
|
|
|
'This %s file is stored in Git Large File Storage.',
|
|
|
|
phutil_format_bytes($ref->getByteSize()));
|
|
|
|
|
|
|
|
try {
|
|
|
|
$file = $this->loadGitLFSFile($ref);
|
2017-12-13 15:02:09 +01:00
|
|
|
$this->corpusButtons[] = $this->renderGitLFSButton();
|
2016-03-18 16:13:20 +01:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$severity = PHUIInfoView::SEVERITY_ERROR;
|
|
|
|
$messages[] = pht('The data for this file could not be loaded.');
|
|
|
|
}
|
|
|
|
|
2017-08-21 22:07:38 +02:00
|
|
|
$this->corpusButtons[] = $this->renderFileButton(
|
|
|
|
null, pht('View Raw LFS Pointer'));
|
2016-03-18 16:13:20 +01:00
|
|
|
|
|
|
|
$corpus = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2016-03-18 16:13:20 +01:00
|
|
|
->setCollapsed(true);
|
|
|
|
|
|
|
|
if ($messages) {
|
|
|
|
$corpus->setInfoView(
|
|
|
|
id(new PHUIInfoView())
|
|
|
|
->setSeverity($severity)
|
|
|
|
->setErrors($messages));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $corpus;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function loadGitLFSFile(PhabricatorRepositoryGitLFSRef $ref) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withPHIDs(array($ref->getFilePHID()))
|
|
|
|
->executeOne();
|
|
|
|
if (!$file) {
|
|
|
|
throw new Exception(
|
|
|
|
pht(
|
|
|
|
'Failed to load file object for Git LFS ref "%s"!',
|
|
|
|
$ref->getObjectHash()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $file;
|
|
|
|
}
|
|
|
|
|
2016-12-06 03:09:51 +01:00
|
|
|
private function buildBranchTable() {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$branch = $drequest->getBranch();
|
|
|
|
$default_branch = $repository->getDefaultBranch();
|
|
|
|
|
|
|
|
if ($branch === $default_branch) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$pager = id(new PHUIPagerView())
|
|
|
|
->setPageSize(10);
|
|
|
|
|
|
|
|
try {
|
|
|
|
$results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.historyquery',
|
|
|
|
array(
|
|
|
|
'commit' => $branch,
|
|
|
|
'against' => $default_branch,
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'offset' => $pager->getOffset(),
|
|
|
|
'limit' => $pager->getPageSize() + 1,
|
|
|
|
));
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$history = DiffusionPathChange::newFromConduit($results['pathChanges']);
|
|
|
|
$history = $pager->sliceResults($history);
|
|
|
|
|
|
|
|
if (!$history) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$history_table = id(new DiffusionHistoryTableView())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setHistory($history);
|
|
|
|
|
|
|
|
$history_table->loadRevisions();
|
|
|
|
|
|
|
|
$history_table
|
|
|
|
->setParents($results['parents'])
|
|
|
|
->setFilterParents(true)
|
|
|
|
->setIsHead(true)
|
|
|
|
->setIsTail(!$pager->getHasMorePages());
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(pht('%s vs %s', $branch, $default_branch));
|
|
|
|
|
|
|
|
return id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
Mobile layouts for Diffusion
Summary: Implements a new mobile view thats more fullscreen, not boxed, so more space. Fixes issues with mobile tables when scrolling overflowed content.
Test Plan: Test home, branch, tags, code, file browse, graph, compare, history, readme, open revisions, owners.
Reviewers: epriestley
Reviewed By: epriestley
Spies: Korvin
Differential Revision: https://secure.phabricator.com/D18505
2017-08-30 21:00:07 +02:00
|
|
|
->addClass('diffusion-mobile-view')
|
2016-12-06 03:09:51 +01:00
|
|
|
->setTable($history_table);
|
|
|
|
}
|
2016-03-18 16:13:20 +01:00
|
|
|
|
2018-03-07 16:02:34 +01:00
|
|
|
private function getLineNumberBaseURI() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
|
|
|
return (string)$drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'stable' => true,
|
|
|
|
));
|
|
|
|
}
|
2011-03-08 02:25:47 +01:00
|
|
|
}
|