2011-03-13 01:17:34 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DiffusionRepositoryController extends DiffusionController {
|
2011-03-13 01:17:34 +01:00
|
|
|
|
2016-12-08 15:39:33 +01:00
|
|
|
private $historyFuture;
|
|
|
|
private $browseFuture;
|
|
|
|
private $tagFuture;
|
|
|
|
private $branchFuture;
|
|
|
|
|
2013-09-23 21:53:41 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-05 19:34:04 +01:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$response = $this->loadDiffusionContext();
|
|
|
|
if ($response) {
|
|
|
|
return $response;
|
|
|
|
}
|
2014-07-12 16:05:19 +02:00
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
require_celerity_resource('diffusion-css');
|
|
|
|
|
2016-01-05 19:34:04 +01:00
|
|
|
$viewer = $this->getViewer();
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
2011-03-13 01:17:34 +01:00
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs();
|
2016-03-17 20:01:22 +01:00
|
|
|
$crumbs->setBorder(true);
|
2011-03-13 01:17:34 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$header = $this->buildHeaderView($repository);
|
2017-07-10 03:38:38 +02:00
|
|
|
$actions = $this->buildActionList($repository);
|
2016-03-17 20:01:22 +01:00
|
|
|
$description = $this->buildDescriptionView($repository);
|
|
|
|
$locate_file = $this->buildLocateFile();
|
2014-07-12 16:05:19 +02:00
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
$header->setActionList($actions);
|
|
|
|
|
2014-07-12 16:05:19 +02:00
|
|
|
// Before we do any work, make sure we're looking at a some content: we're
|
|
|
|
// on a valid branch, and the repository is not empty.
|
|
|
|
$page_has_content = false;
|
|
|
|
$empty_title = null;
|
|
|
|
$empty_message = null;
|
|
|
|
|
|
|
|
// If this VCS supports branches, check that the selected branch actually
|
|
|
|
// exists.
|
|
|
|
if ($drequest->supportsBranches()) {
|
2014-07-13 15:55:04 +02:00
|
|
|
// NOTE: Mercurial may have multiple branch heads with the same name.
|
|
|
|
$ref_cursors = id(new PhabricatorRepositoryRefCursorQuery())
|
2014-07-12 16:05:19 +02:00
|
|
|
->setViewer($viewer)
|
|
|
|
->withRepositoryPHIDs(array($repository->getPHID()))
|
|
|
|
->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH))
|
|
|
|
->withRefNames(array($drequest->getBranch()))
|
2014-07-13 15:55:04 +02:00
|
|
|
->execute();
|
|
|
|
if ($ref_cursors) {
|
2014-07-12 16:05:19 +02:00
|
|
|
// This is a valid branch, so we necessarily have some content.
|
|
|
|
$page_has_content = true;
|
|
|
|
} else {
|
|
|
|
$empty_title = pht('No Such Branch');
|
|
|
|
$empty_message = pht(
|
|
|
|
'There is no branch named "%s" in this repository.',
|
|
|
|
$drequest->getBranch());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we didn't find any branches, check if there are any commits at all.
|
|
|
|
// This can tailor the message for empty repositories.
|
|
|
|
if (!$page_has_content) {
|
|
|
|
$any_commit = id(new DiffusionCommitQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withRepository($repository)
|
|
|
|
->setLimit(1)
|
|
|
|
->execute();
|
|
|
|
if ($any_commit) {
|
|
|
|
if (!$drequest->supportsBranches()) {
|
|
|
|
$page_has_content = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$empty_title = pht('Empty Repository');
|
2015-05-22 09:27:56 +02:00
|
|
|
$empty_message = pht('This repository does not have any commits yet.');
|
2014-07-12 16:05:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($page_has_content) {
|
2016-03-17 20:01:22 +01:00
|
|
|
$content = $this->buildNormalContent($drequest);
|
2014-07-12 16:05:19 +02:00
|
|
|
} else {
|
2016-03-17 20:01:22 +01:00
|
|
|
$content = id(new PHUIInfoView())
|
2014-07-12 16:05:19 +02:00
|
|
|
->setTitle($empty_title)
|
2015-03-01 23:45:56 +01:00
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
2014-07-12 16:05:19 +02:00
|
|
|
->setErrors(array($empty_message));
|
|
|
|
}
|
|
|
|
|
2017-07-05 23:09:12 +02:00
|
|
|
$tabs = $this->buildTabsView('home');
|
|
|
|
|
2017-07-11 05:20:09 +02:00
|
|
|
$clone_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'clone',
|
|
|
|
));
|
|
|
|
|
|
|
|
$clone_button = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setText('Clone')
|
|
|
|
->setColor(PHUIButtonView::GREEN)
|
|
|
|
->setIcon('fa-download')
|
|
|
|
->setWorkflow(true)
|
|
|
|
->setHref($clone_uri);
|
|
|
|
|
|
|
|
$bar = id(new PHUILeftRightView())
|
|
|
|
->setLeft($locate_file)
|
|
|
|
->setRight($clone_button);
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
2017-07-05 23:09:12 +02:00
|
|
|
->setTabs($tabs)
|
2017-07-10 03:38:38 +02:00
|
|
|
->setFooter(array(
|
2017-07-11 05:20:09 +02:00
|
|
|
$bar,
|
2016-03-17 20:01:22 +01:00
|
|
|
$description,
|
2017-07-10 03:38:38 +02:00
|
|
|
$content,
|
|
|
|
));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2016-01-05 19:34:04 +01:00
|
|
|
return $this->newPage()
|
|
|
|
->setTitle(
|
|
|
|
array(
|
|
|
|
$repository->getName(),
|
|
|
|
$repository->getDisplayName(),
|
|
|
|
))
|
|
|
|
->setCrumbs($crumbs)
|
2016-03-17 20:01:22 +01:00
|
|
|
->appendChild(array(
|
|
|
|
$view,
|
|
|
|
));
|
2014-07-12 16:05:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function buildNormalContent(DiffusionRequest $drequest) {
|
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
|
|
|
$request = $this->getRequest();
|
2014-07-12 16:05:19 +02:00
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
2016-12-08 15:39:33 +01:00
|
|
|
$commit = $drequest->getCommit();
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
|
|
|
|
$this->historyFuture = $this->callConduitMethod(
|
|
|
|
'diffusion.historyquery',
|
|
|
|
array(
|
|
|
|
'commit' => $commit,
|
|
|
|
'path' => $path,
|
|
|
|
'offset' => 0,
|
|
|
|
'limit' => 15,
|
|
|
|
));
|
|
|
|
|
|
|
|
$browse_pager = id(new PHUIPagerView())
|
|
|
|
->readFromRequest($request);
|
|
|
|
|
|
|
|
$this->browseFuture = $this->callConduitMethod(
|
|
|
|
'diffusion.browsequery',
|
|
|
|
array(
|
|
|
|
'commit' => $commit,
|
|
|
|
'path' => $path,
|
|
|
|
'limit' => $browse_pager->getPageSize() + 1,
|
|
|
|
));
|
|
|
|
|
|
|
|
$futures = array(
|
|
|
|
$this->historyFuture,
|
|
|
|
$this->browseFuture,
|
|
|
|
);
|
|
|
|
$futures = array_filter($futures);
|
|
|
|
$futures = new FutureIterator($futures);
|
|
|
|
foreach ($futures as $future) {
|
|
|
|
// Just resolve all the futures before continuing.
|
|
|
|
}
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$phids = array();
|
2014-07-12 16:05:19 +02:00
|
|
|
$content = array();
|
2012-03-08 21:46:19 +01:00
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
try {
|
2016-12-08 15:39:33 +01:00
|
|
|
$history_results = $this->historyFuture->resolve();
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$history = DiffusionPathChange::newFromConduit(
|
|
|
|
$history_results['pathChanges']);
|
|
|
|
|
|
|
|
foreach ($history as $item) {
|
|
|
|
$data = $item->getCommitData();
|
|
|
|
if ($data) {
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
}
|
|
|
|
if ($data->getCommitDetail('committerPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('committerPHID')] = true;
|
|
|
|
}
|
2012-05-23 17:34:36 +02:00
|
|
|
}
|
2011-04-03 01:39:23 +02:00
|
|
|
}
|
2013-10-27 05:08:24 +01:00
|
|
|
$history_exception = null;
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$history_results = null;
|
|
|
|
$history = null;
|
|
|
|
$history_exception = $ex;
|
2011-04-03 01:39:23 +02:00
|
|
|
}
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
try {
|
2016-12-08 15:39:33 +01:00
|
|
|
$browse_results = $this->browseFuture->resolve();
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$browse_results = DiffusionBrowseResultSet::newFromConduit(
|
2016-12-08 15:39:33 +01:00
|
|
|
$browse_results);
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$browse_paths = $browse_results->getPaths();
|
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
|
|
|
$browse_paths = $browse_pager->sliceResults($browse_paths);
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
|
|
|
foreach ($browse_paths as $item) {
|
|
|
|
$data = $item->getLastCommitData();
|
|
|
|
if ($data) {
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
}
|
|
|
|
if ($data->getCommitDetail('committerPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('committerPHID')] = true;
|
|
|
|
}
|
2012-05-23 17:34:36 +02:00
|
|
|
}
|
2011-04-03 01:39:23 +02:00
|
|
|
}
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
2013-10-27 05:08:24 +01:00
|
|
|
$browse_exception = null;
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$browse_results = null;
|
|
|
|
$browse_paths = null;
|
|
|
|
$browse_exception = $ex;
|
2011-04-03 01:39:23 +02:00
|
|
|
}
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
2011-04-03 01:39:23 +02:00
|
|
|
$phids = array_keys($phids);
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-03 01:39:23 +02:00
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
if ($browse_results) {
|
2016-01-07 12:50:16 +01:00
|
|
|
$readme = $this->renderDirectoryReadme($browse_results);
|
|
|
|
} else {
|
|
|
|
$readme = null;
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
}
|
2013-05-21 22:47:06 +02:00
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$content[] = $this->buildBrowseTable(
|
|
|
|
$browse_results,
|
|
|
|
$browse_paths,
|
|
|
|
$browse_exception,
|
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
|
|
|
$handles,
|
|
|
|
$browse_pager);
|
2011-03-13 01:17:34 +01:00
|
|
|
|
2014-05-13 04:57:12 +02:00
|
|
|
$content[] = $this->buildHistoryTable(
|
|
|
|
$history_results,
|
|
|
|
$history,
|
2015-09-11 04:28:49 +02:00
|
|
|
$history_exception);
|
2014-05-13 04:57:12 +02:00
|
|
|
|
2012-04-30 16:47:41 +02:00
|
|
|
if ($readme) {
|
2014-12-31 20:54:52 +01:00
|
|
|
$content[] = $readme;
|
2012-04-30 16:47:41 +02:00
|
|
|
}
|
|
|
|
|
2014-07-12 16:05:19 +02:00
|
|
|
return $content;
|
2011-03-13 01:17:34 +01:00
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
private function buildHeaderView(PhabricatorRepository $repository) {
|
|
|
|
$viewer = $this->getViewer();
|
2013-09-17 18:12:37 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
2013-09-19 20:57:09 +02:00
|
|
|
->setHeader($repository->getName())
|
2016-03-17 20:01:22 +01:00
|
|
|
->setUser($viewer)
|
|
|
|
->setPolicyObject($repository)
|
2017-06-12 16:51:16 +02:00
|
|
|
->setProfileHeader(true)
|
|
|
|
->setImage($repository->getProfileImageURI())
|
2017-07-10 03:38:38 +02:00
|
|
|
->setImageEditURL('/diffusion/picture/'.$repository->getID().'/')
|
|
|
|
->addClass('diffusion-profile-header');
|
2013-09-19 20:57:09 +02:00
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
if (!$repository->isTracked()) {
|
2014-05-19 01:10:54 +02:00
|
|
|
$header->setStatus('fa-ban', 'dark', pht('Inactive'));
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
} else if ($repository->isImporting()) {
|
2016-01-05 22:36:32 +01:00
|
|
|
$ratio = $repository->loadImportProgress();
|
|
|
|
$percentage = sprintf('%.2f%%', 100 * $ratio);
|
|
|
|
$header->setStatus(
|
|
|
|
'fa-clock-o',
|
|
|
|
'indigo',
|
|
|
|
pht('Importing (%s)...', $percentage));
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
} else {
|
2014-05-19 01:10:54 +02:00
|
|
|
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
return $header;
|
|
|
|
}
|
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
private function buildActionList(PhabricatorRepository $repository) {
|
2016-03-17 20:01:22 +01:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
2016-05-03 23:26:09 +02:00
|
|
|
$edit_uri = $repository->getPathURI('manage/');
|
2017-07-10 03:38:38 +02:00
|
|
|
$action_view = id(new PhabricatorActionListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setObject($repository);
|
2016-03-17 20:01:22 +01:00
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
$action_view->addAction(
|
2016-03-17 20:01:22 +01:00
|
|
|
id(new PhabricatorActionView())
|
2016-05-03 23:26:09 +02:00
|
|
|
->setName(pht('Manage Repository'))
|
|
|
|
->setIcon('fa-cogs')
|
|
|
|
->setHref($edit_uri));
|
2016-03-17 20:01:22 +01:00
|
|
|
|
|
|
|
if ($repository->isHosted()) {
|
|
|
|
$push_uri = $this->getApplicationURI(
|
|
|
|
'pushlog/?repositories='.$repository->getMonogram());
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
$action_view->addAction(
|
2016-03-17 20:01:22 +01:00
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('View Push Logs'))
|
|
|
|
->setIcon('fa-list-alt')
|
|
|
|
->setHref($push_uri));
|
|
|
|
}
|
2013-05-24 19:48:10 +02:00
|
|
|
|
2017-07-10 03:38:38 +02:00
|
|
|
return $action_view;
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function buildDescriptionView(PhabricatorRepository $repository) {
|
|
|
|
$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);
|
|
|
|
|
|
|
|
$description = $repository->getDetail('description');
|
|
|
|
if (strlen($description)) {
|
|
|
|
$description = new PHUIRemarkupView($viewer, $description);
|
|
|
|
$view->addTextContent($description);
|
|
|
|
return id(new PHUIObjectBoxView())
|
2017-07-10 03:38:38 +02:00
|
|
|
->appendChild($view)
|
|
|
|
->addClass('diffusion-profile-description');
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
private function buildHistoryTable(
|
|
|
|
$history_results,
|
|
|
|
$history,
|
2015-09-11 04:28:49 +02:00
|
|
|
$history_exception) {
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
if ($history_exception) {
|
|
|
|
if ($repository->isImporting()) {
|
|
|
|
return $this->renderStatusMessage(
|
|
|
|
pht('Still Importing...'),
|
|
|
|
pht(
|
|
|
|
'This repository is still importing. History is not yet '.
|
|
|
|
'available.'));
|
|
|
|
} else {
|
|
|
|
return $this->renderStatusMessage(
|
|
|
|
pht('Unable to Retrieve History'),
|
|
|
|
$history_exception->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$history_table = id(new DiffusionHistoryTableView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setHistory($history);
|
|
|
|
|
|
|
|
// TODO: Super sketchy.
|
|
|
|
$history_table->loadRevisions();
|
|
|
|
|
|
|
|
if ($history_results) {
|
|
|
|
$history_table->setParents($history_results['parents']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$history_table->setIsHead(true);
|
2014-01-09 17:51:57 +01:00
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
$panel = id(new PHUIObjectBoxView())
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
2014-01-09 17:51:57 +01:00
|
|
|
$header = id(new PHUIHeaderView())
|
2017-07-05 23:09:12 +02:00
|
|
|
->setHeader(pht('Recent Commits'));
|
2014-01-09 17:51:57 +01:00
|
|
|
$panel->setHeader($header);
|
2015-05-20 08:14:22 +02:00
|
|
|
$panel->setTable($history_table);
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
2016-03-17 20:01:22 +01:00
|
|
|
private function buildLocateFile() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
2017-07-12 04:46:58 +02:00
|
|
|
$form_box = null;
|
2016-03-17 20:01:22 +01:00
|
|
|
if ($repository->canUsePathTree()) {
|
|
|
|
Javelin::initBehavior(
|
|
|
|
'diffusion-locate-file',
|
|
|
|
array(
|
|
|
|
'controlID' => 'locate-control',
|
|
|
|
'inputID' => 'locate-input',
|
|
|
|
'browseBaseURI' => (string)$drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
)),
|
|
|
|
'uri' => (string)$drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'pathtree',
|
|
|
|
)),
|
|
|
|
));
|
|
|
|
|
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTypeaheadControl())
|
|
|
|
->setHardpointID('locate-control')
|
|
|
|
->setID('locate-input')
|
2017-07-10 03:38:38 +02:00
|
|
|
->setPlaceholder(pht('Locate File')));
|
2016-03-17 20:01:22 +01:00
|
|
|
$form_box = id(new PHUIBoxView())
|
2017-07-10 03:38:38 +02:00
|
|
|
->appendChild($form->buildLayoutView())
|
|
|
|
->addClass('diffusion-profile-locate');
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
2017-07-10 03:38:38 +02:00
|
|
|
return $form_box;
|
2016-03-17 20:01:22 +01:00
|
|
|
}
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
private function buildBrowseTable(
|
|
|
|
$browse_results,
|
|
|
|
$browse_paths,
|
|
|
|
$browse_exception,
|
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
|
|
|
array $handles,
|
|
|
|
PHUIPagerView $pager) {
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
|
2014-06-13 20:36:01 +02:00
|
|
|
require_celerity_resource('diffusion-icons-css');
|
|
|
|
|
Add an "importing" state to repositories and clean up the UI
Summary:
Fixes T3217. Ref T776. Ref T1493. Broadly, this introduces a mechanism which works like this:
- When a repository is created, we set an "importing" flag.
- After discovery completes, we check if a repository has no importing commits. Basically, this is the first time we catch up to HEAD.
- If we're caught up, clear the "importing" flag.
This flag lets us fix some issues:
- T3217. Currently, when you import a new repository and users have rules like "Email me on every commit ever" or "trigger an audit on every commit", we take a bunch of publish actions. Instead, implicitly disable publishing during import.
- An imported but un-pulled repository currently has an incomprehensible error on `/diffusion/X/`. Fix that.
- Show more cues in the UI about importing.
- Made some exceptions more specific.
Test Plan:
This is the new screen for a completely new repo, replacing a giant exception:
{F75443}
- Created a repository, saw it "importing".
- Pulled and discovered it.
- Processed its commits.
- Ran discovery again, saw import flag clear.
- Also this repository was empty, which hit some of the other code.
This is the new "parsed empty repository" UI, which isn't good, but is less broken:
{F75446}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, hach-que
Maniphest Tasks: T3607, T1493, T776, T3217
Differential Revision: https://secure.phabricator.com/D7429
2013-10-27 03:59:57 +01:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
if ($browse_exception) {
|
|
|
|
if ($repository->isImporting()) {
|
|
|
|
// The history table renders a useful message.
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
return $this->renderStatusMessage(
|
|
|
|
pht('Unable to Retrieve Paths'),
|
|
|
|
$browse_exception->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$browse_table = id(new DiffusionBrowseTableView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setHandles($handles);
|
|
|
|
if ($browse_paths) {
|
|
|
|
$browse_table->setPaths($browse_paths);
|
|
|
|
} else {
|
|
|
|
$browse_table->setPaths(array());
|
|
|
|
}
|
|
|
|
|
|
|
|
$browse_uri = $drequest->generateURI(array('action' => 'browse'));
|
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->setURI($browse_uri, 'offset');
|
|
|
|
|
2017-07-11 05:20:09 +02:00
|
|
|
return id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText($repository->getName())
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
|
|
->setTable($browse_table)
|
|
|
|
->setPager($pager);
|
2013-11-02 01:35:43 +01:00
|
|
|
}
|
|
|
|
|
2016-12-08 15:39:33 +01:00
|
|
|
private function getTagLimit() {
|
|
|
|
return 15;
|
|
|
|
}
|
|
|
|
|
2011-03-13 01:17:34 +01:00
|
|
|
}
|