2011-03-12 16:17:34 -08:00
|
|
|
<?php
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class DiffusionRepositoryController extends DiffusionController {
|
2011-03-12 16:17:34 -08:00
|
|
|
|
2013-09-23 12:53:41 -07:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-09 13:29:08 -08:00
|
|
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
2014-07-12 07:05:19 -07:00
|
|
|
$viewer = $request->getUser();
|
|
|
|
|
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-26 19:59:57 -07:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
2011-03-12 16:17:34 -08:00
|
|
|
|
|
|
|
$content = array();
|
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs();
|
|
|
|
$content[] = $crumbs;
|
|
|
|
|
2012-03-08 12:46:19 -08:00
|
|
|
$content[] = $this->buildPropertiesTable($drequest->getRepository());
|
2014-07-12 07:05:19 -07: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 06:55:04 -07:00
|
|
|
// NOTE: Mercurial may have multiple branch heads with the same name.
|
|
|
|
$ref_cursors = id(new PhabricatorRepositoryRefCursorQuery())
|
2014-07-12 07:05:19 -07:00
|
|
|
->setViewer($viewer)
|
|
|
|
->withRepositoryPHIDs(array($repository->getPHID()))
|
|
|
|
->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH))
|
|
|
|
->withRefNames(array($drequest->getBranch()))
|
2014-07-13 06:55:04 -07:00
|
|
|
->execute();
|
|
|
|
if ($ref_cursors) {
|
2014-07-12 07:05:19 -07: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 17:27:56 +10:00
|
|
|
$empty_message = pht('This repository does not have any commits yet.');
|
2014-07-12 07:05:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($page_has_content) {
|
|
|
|
$content[] = $this->buildNormalContent($drequest);
|
|
|
|
} else {
|
2015-03-01 14:45:56 -08:00
|
|
|
$content[] = id(new PHUIInfoView())
|
2014-07-12 07:05:19 -07:00
|
|
|
->setTitle($empty_title)
|
2015-03-01 14:45:56 -08:00
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
2014-07-12 07:05:19 -07:00
|
|
|
->setErrors(array($empty_message));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$content,
|
|
|
|
array(
|
|
|
|
'title' => $drequest->getRepository()->getName(),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function buildNormalContent(DiffusionRequest $drequest) {
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
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-26 19:59:57 -07:00
|
|
|
$phids = array();
|
2014-07-12 07:05:19 -07:00
|
|
|
$content = array();
|
2012-03-08 12:46:19 -08: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-26 19:59:57 -07:00
|
|
|
try {
|
|
|
|
$history_results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.historyquery',
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 11:02:58 -07:00
|
|
|
array(
|
|
|
|
'commit' => $drequest->getCommit(),
|
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-26 19:59:57 -07:00
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'offset' => 0,
|
2014-10-08 00:01:04 +11:00
|
|
|
'limit' => 15,
|
|
|
|
));
|
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-26 19:59:57 -07: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 08:34:36 -07:00
|
|
|
}
|
2011-04-02 16:39:23 -07:00
|
|
|
}
|
2013-10-26 21:08:24 -07: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-26 19:59:57 -07:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$history_results = null;
|
|
|
|
$history = null;
|
|
|
|
$history_exception = $ex;
|
2011-04-02 16:39:23 -07: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-26 19:59:57 -07:00
|
|
|
try {
|
|
|
|
$browse_results = DiffusionBrowseResultSet::newFromConduit(
|
|
|
|
$this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.browsequery',
|
|
|
|
array(
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
)));
|
|
|
|
$browse_paths = $browse_results->getPaths();
|
|
|
|
|
|
|
|
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 08:34:36 -07:00
|
|
|
}
|
2011-04-02 16:39:23 -07: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-26 19:59:57 -07:00
|
|
|
|
2013-10-26 21:08:24 -07: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-26 19:59:57 -07:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$browse_results = null;
|
|
|
|
$browse_paths = null;
|
|
|
|
$browse_exception = $ex;
|
2011-04-02 16:39:23 -07: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-26 19:59:57 -07:00
|
|
|
|
2011-04-02 16:39:23 -07:00
|
|
|
$phids = array_keys($phids);
|
2012-09-04 19:02:56 -07:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-02 16:39:23 -07:00
|
|
|
|
2014-12-31 11:54:52 -08:00
|
|
|
$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-26 19:59:57 -07:00
|
|
|
if ($browse_results) {
|
2014-12-31 11:54:52 -08:00
|
|
|
$readme_path = $browse_results->getReadmePath();
|
|
|
|
if ($readme_path) {
|
|
|
|
$readme_content = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.filecontentquery',
|
|
|
|
array(
|
|
|
|
'path' => $readme_path,
|
|
|
|
'commit' => $drequest->getStableCommit(),
|
|
|
|
));
|
|
|
|
if ($readme_content) {
|
|
|
|
$readme = id(new DiffusionReadmeView())
|
|
|
|
->setUser($this->getViewer())
|
|
|
|
->setPath($readme_path)
|
|
|
|
->setContent($readme_content['corpus']);
|
|
|
|
}
|
|
|
|
}
|
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-26 19:59:57 -07:00
|
|
|
}
|
2013-05-21 13:47:06 -07: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-26 19:59:57 -07:00
|
|
|
$content[] = $this->buildBrowseTable(
|
|
|
|
$browse_results,
|
|
|
|
$browse_paths,
|
|
|
|
$browse_exception,
|
|
|
|
$handles);
|
2011-03-12 16:17:34 -08:00
|
|
|
|
2014-05-12 19:57:12 -07:00
|
|
|
$content[] = $this->buildHistoryTable(
|
|
|
|
$history_results,
|
|
|
|
$history,
|
2015-09-10 19:28:49 -07:00
|
|
|
$history_exception);
|
2014-05-12 19:57:12 -07: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-26 19:59:57 -07:00
|
|
|
try {
|
|
|
|
$content[] = $this->buildTagListTable($drequest);
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
if (!$repository->isImporting()) {
|
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
pht('Unable to Load Tags'),
|
|
|
|
$ex->getMessage());
|
|
|
|
}
|
|
|
|
}
|
2012-04-18 08:02:08 -07: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-26 19:59:57 -07:00
|
|
|
try {
|
|
|
|
$content[] = $this->buildBranchListTable($drequest);
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
if (!$repository->isImporting()) {
|
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
pht('Unable to Load Branches'),
|
|
|
|
$ex->getMessage());
|
|
|
|
}
|
|
|
|
}
|
2011-03-12 16:17:34 -08:00
|
|
|
|
2012-04-30 07:47:41 -07:00
|
|
|
if ($readme) {
|
2014-12-31 11:54:52 -08:00
|
|
|
$content[] = $readme;
|
2012-04-30 07:47:41 -07:00
|
|
|
}
|
|
|
|
|
2014-07-12 07:05:19 -07:00
|
|
|
return $content;
|
2011-03-12 16:17:34 -08:00
|
|
|
}
|
|
|
|
|
2012-03-08 12:46:19 -08:00
|
|
|
private function buildPropertiesTable(PhabricatorRepository $repository) {
|
2013-05-24 12:38:44 -07:00
|
|
|
$user = $this->getRequest()->getUser();
|
2012-03-08 12:46:19 -08:00
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$header = id(new PHUIHeaderView())
|
2013-09-19 11:57:09 -07:00
|
|
|
->setHeader($repository->getName())
|
|
|
|
->setUser($user)
|
|
|
|
->setPolicyObject($repository);
|
|
|
|
|
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-26 19:59:57 -07:00
|
|
|
if (!$repository->isTracked()) {
|
2014-05-18 16:10:54 -07: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-26 19:59:57 -07:00
|
|
|
} else if ($repository->isImporting()) {
|
2014-05-18 16:10:54 -07:00
|
|
|
$header->setStatus('fa-clock-o', 'indigo', pht('Importing...'));
|
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-26 19:59:57 -07:00
|
|
|
} else {
|
2014-05-18 16:10:54 -07: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-26 19:59:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-19 11:57:09 -07:00
|
|
|
$actions = $this->buildActionList($repository);
|
2013-05-24 10:48:10 -07:00
|
|
|
|
2013-10-11 07:53:56 -07:00
|
|
|
$view = id(new PHUIPropertyListView())
|
2015-07-08 07:00:17 -07:00
|
|
|
->setObject($repository)
|
2013-05-24 12:38:44 -07:00
|
|
|
->setUser($user);
|
2013-05-24 10:48:10 -07:00
|
|
|
|
2013-11-01 17:35:43 -07:00
|
|
|
if ($repository->isHosted()) {
|
2014-01-30 11:41:21 -08:00
|
|
|
$ssh_uri = $repository->getSSHCloneURIObject();
|
|
|
|
if ($ssh_uri) {
|
2014-01-30 11:42:10 -08:00
|
|
|
$clone_uri = $this->renderCloneCommand(
|
|
|
|
$repository,
|
2014-01-30 11:41:21 -08:00
|
|
|
$ssh_uri,
|
|
|
|
$repository->getServeOverSSH(),
|
2013-11-01 17:35:43 -07:00
|
|
|
'/settings/panel/ssh/');
|
|
|
|
|
2014-01-30 11:42:10 -08:00
|
|
|
$view->addProperty(
|
|
|
|
$repository->isSVN()
|
|
|
|
? pht('Checkout (SSH)')
|
|
|
|
: pht('Clone (SSH)'),
|
|
|
|
$clone_uri);
|
2013-11-01 17:35:43 -07:00
|
|
|
}
|
|
|
|
|
2014-01-30 11:41:21 -08:00
|
|
|
$http_uri = $repository->getHTTPCloneURIObject();
|
|
|
|
if ($http_uri) {
|
2014-01-30 11:42:10 -08:00
|
|
|
$clone_uri = $this->renderCloneCommand(
|
|
|
|
$repository,
|
2013-11-01 17:35:43 -07:00
|
|
|
$http_uri,
|
2014-01-30 11:41:21 -08:00
|
|
|
$repository->getServeOverHTTP(),
|
2013-11-01 17:35:43 -07:00
|
|
|
PhabricatorEnv::getEnvConfig('diffusion.allow-http-auth')
|
|
|
|
? '/settings/panel/vcspassword/'
|
|
|
|
: null);
|
|
|
|
|
2014-01-30 11:42:10 -08:00
|
|
|
$view->addProperty(
|
|
|
|
$repository->isSVN()
|
|
|
|
? pht('Checkout (HTTP)')
|
|
|
|
: pht('Clone (HTTP)'),
|
|
|
|
$clone_uri);
|
2013-11-01 17:35:43 -07:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$view->addProperty(
|
2014-01-30 11:42:10 -08:00
|
|
|
pht('Clone'),
|
|
|
|
$this->renderCloneCommand(
|
|
|
|
$repository,
|
2014-01-30 11:41:21 -08:00
|
|
|
$repository->getPublicCloneURI()));
|
2013-11-01 17:35:43 -07:00
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$view->addProperty(
|
2014-01-30 11:42:10 -08:00
|
|
|
pht('Checkout'),
|
|
|
|
$this->renderCloneCommand(
|
|
|
|
$repository,
|
2014-01-30 11:41:21 -08:00
|
|
|
$repository->getPublicCloneURI()));
|
2013-11-01 17:35:43 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-03-08 12:46:19 -08:00
|
|
|
}
|
|
|
|
|
2015-07-08 07:00:17 -07:00
|
|
|
$view->invokeWillRenderEvent();
|
|
|
|
|
2013-05-24 10:48:10 -07:00
|
|
|
$description = $repository->getDetail('description');
|
|
|
|
if (strlen($description)) {
|
2013-05-24 12:38:44 -07:00
|
|
|
$description = PhabricatorMarkupEngine::renderOneObject(
|
|
|
|
$repository,
|
|
|
|
'description',
|
|
|
|
$user);
|
2013-10-30 08:21:16 -07:00
|
|
|
$view->addSectionHeader(pht('Description'));
|
2013-05-24 10:48:10 -07:00
|
|
|
$view->addTextContent($description);
|
2012-03-08 12:46:19 -08:00
|
|
|
}
|
|
|
|
|
2013-10-11 07:53:56 -07:00
|
|
|
$view->setActionList($actions);
|
|
|
|
|
2015-04-27 03:49:57 -07:00
|
|
|
$box = id(new PHUIObjectBoxView())
|
2013-09-28 15:55:38 -07:00
|
|
|
->setHeader($header)
|
2013-10-11 07:53:56 -07:00
|
|
|
->addPropertyList($view);
|
2013-09-28 15:55:38 -07:00
|
|
|
|
2015-04-27 03:49:57 -07:00
|
|
|
$info = null;
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2015-09-03 10:03:31 -07:00
|
|
|
|
|
|
|
// Try to load alternatives. This may fail for repositories which have not
|
|
|
|
// cloned yet. If it does, just ignore it and continue.
|
|
|
|
try {
|
|
|
|
$alternatives = $drequest->getRefAlternatives();
|
|
|
|
} catch (ConduitClientException $ex) {
|
|
|
|
$alternatives = array();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($alternatives) {
|
2015-04-27 03:49:57 -07:00
|
|
|
$message = array(
|
|
|
|
pht(
|
|
|
|
'The ref "%s" is ambiguous in this repository.',
|
|
|
|
$drequest->getBranch()),
|
|
|
|
' ',
|
|
|
|
phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'refs',
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
pht('View Alternatives')),
|
|
|
|
);
|
|
|
|
|
|
|
|
$messages = array($message);
|
|
|
|
|
|
|
|
$info = id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
|
|
|
->setErrors(array($message));
|
|
|
|
|
|
|
|
$box->setInfoView($info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $box;
|
2012-03-08 12:46:19 -08:00
|
|
|
}
|
|
|
|
|
2012-05-10 09:28:19 +02:00
|
|
|
private function buildBranchListTable(DiffusionRequest $drequest) {
|
2013-10-30 13:06:28 -07:00
|
|
|
$viewer = $this->getRequest()->getUser();
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2013-10-30 13:06:28 -07:00
|
|
|
if ($drequest->getBranch() === null) {
|
|
|
|
return null;
|
|
|
|
}
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2013-10-30 13:06:28 -07:00
|
|
|
$limit = 15;
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2014-01-17 16:10:56 -08:00
|
|
|
$branches = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.branchquery',
|
|
|
|
array(
|
2015-04-27 03:51:21 -07:00
|
|
|
'closed' => false,
|
2014-01-17 16:10:56 -08:00
|
|
|
'limit' => $limit + 1,
|
|
|
|
));
|
2013-10-30 13:06:28 -07:00
|
|
|
if (!$branches) {
|
|
|
|
return null;
|
|
|
|
}
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2013-10-30 13:06:28 -07:00
|
|
|
$more_branches = (count($branches) > $limit);
|
|
|
|
$branches = array_slice($branches, 0, $limit);
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2014-01-17 16:10:56 -08:00
|
|
|
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
|
|
|
|
|
2013-10-30 13:06:28 -07:00
|
|
|
$commits = id(new DiffusionCommitQuery())
|
|
|
|
->setViewer($viewer)
|
2014-01-17 16:10:56 -08:00
|
|
|
->withIdentifiers(mpull($branches, 'getCommitIdentifier'))
|
2013-11-07 12:10:43 -08:00
|
|
|
->withRepository($drequest->getRepository())
|
2013-10-30 13:06:28 -07:00
|
|
|
->execute();
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2013-10-30 13:06:43 -07:00
|
|
|
$table = id(new DiffusionBranchTableView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setBranches($branches)
|
|
|
|
->setCommits($commits);
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2014-01-07 11:57:37 -08:00
|
|
|
$panel = new PHUIObjectBoxView();
|
|
|
|
$header = new PHUIHeaderView();
|
|
|
|
$header->setHeader(pht('Branches'));
|
2012-05-10 09:28:19 +02:00
|
|
|
|
2013-10-30 13:06:28 -07:00
|
|
|
if ($more_branches) {
|
2014-01-07 11:57:37 -08:00
|
|
|
$header->setSubHeader(pht('Showing %d branches.', $limit));
|
2012-05-10 09:28:19 +02:00
|
|
|
}
|
|
|
|
|
2014-01-09 08:51:57 -08:00
|
|
|
$icon = id(new PHUIIconView())
|
2014-06-13 11:36:01 -07:00
|
|
|
->setIconFont('fa-code-fork');
|
2014-01-09 08:51:57 -08:00
|
|
|
|
2014-01-07 11:57:37 -08:00
|
|
|
$button = new PHUIButtonView();
|
2014-06-09 11:36:49 -07:00
|
|
|
$button->setText(pht('Show All Branches'));
|
2014-01-07 11:57:37 -08:00
|
|
|
$button->setTag('a');
|
2014-01-09 08:51:57 -08:00
|
|
|
$button->setIcon($icon);
|
2014-01-07 11:57:37 -08:00
|
|
|
$button->setHref($drequest->generateURI(
|
2015-05-22 17:27:56 +10:00
|
|
|
array(
|
|
|
|
'action' => 'branches',
|
|
|
|
)));
|
2013-10-30 13:06:28 -07:00
|
|
|
|
2014-01-07 11:57:37 -08:00
|
|
|
$header->addActionLink($button);
|
|
|
|
$panel->setHeader($header);
|
2015-05-19 23:14:22 -07:00
|
|
|
$panel->setTable($table);
|
2013-10-30 13:06:28 -07:00
|
|
|
|
|
|
|
return $panel;
|
2012-05-10 09:28:19 +02:00
|
|
|
}
|
|
|
|
|
2012-04-18 08:02:08 -07:00
|
|
|
private function buildTagListTable(DiffusionRequest $drequest) {
|
2013-10-30 13:06:43 -07:00
|
|
|
$viewer = $this->getRequest()->getUser();
|
2015-02-17 14:01:17 -08:00
|
|
|
$repository = $drequest->getRepository();
|
2013-10-30 13:06:43 -07:00
|
|
|
|
2015-02-17 14:01:17 -08:00
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
// no tags in SVN
|
|
|
|
return null;
|
|
|
|
}
|
2012-05-10 09:28:19 +02:00
|
|
|
$tag_limit = 15;
|
2013-05-10 15:22:35 -07:00
|
|
|
$tags = array();
|
2015-02-17 14:01:17 -08:00
|
|
|
$tags = DiffusionRepositoryTag::newFromConduit(
|
|
|
|
$this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.tagsquery',
|
|
|
|
array(
|
|
|
|
// On the home page, we want to find tags on any branch.
|
|
|
|
'commit' => null,
|
|
|
|
'limit' => $tag_limit + 1,
|
|
|
|
)));
|
2012-04-18 08:02:08 -07:00
|
|
|
|
|
|
|
if (!$tags) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2012-04-19 09:39:19 -07:00
|
|
|
$more_tags = (count($tags) > $tag_limit);
|
|
|
|
$tags = array_slice($tags, 0, $tag_limit);
|
|
|
|
|
2013-10-30 13:06:43 -07:00
|
|
|
$commits = id(new DiffusionCommitQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIdentifiers(mpull($tags, 'getCommitIdentifier'))
|
2015-02-17 14:01:17 -08:00
|
|
|
->withRepository($repository)
|
2012-04-18 08:02:08 -07:00
|
|
|
->needCommitData(true)
|
|
|
|
->execute();
|
|
|
|
|
2013-10-30 13:06:43 -07:00
|
|
|
$view = id(new DiffusionTagListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setTags($tags)
|
|
|
|
->setCommits($commits);
|
2012-04-18 08:02:08 -07:00
|
|
|
|
|
|
|
$phids = $view->getRequiredHandlePHIDs();
|
2012-09-04 19:02:56 -07:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2012-04-18 08:02:08 -07:00
|
|
|
$view->setHandles($handles);
|
|
|
|
|
2014-01-20 13:12:30 -08:00
|
|
|
$panel = new PHUIObjectBoxView();
|
|
|
|
$header = new PHUIHeaderView();
|
|
|
|
$header->setHeader(pht('Tags'));
|
2012-04-19 09:39:19 -07:00
|
|
|
|
|
|
|
if ($more_tags) {
|
2014-01-20 13:12:30 -08:00
|
|
|
$header->setSubHeader(
|
|
|
|
pht('Showing the %d most recent tags.', $tag_limit));
|
2012-04-19 09:39:19 -07:00
|
|
|
}
|
|
|
|
|
2014-01-20 13:12:30 -08:00
|
|
|
$icon = id(new PHUIIconView())
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIconFont('fa-tag');
|
2014-01-20 13:12:30 -08:00
|
|
|
|
|
|
|
$button = new PHUIButtonView();
|
2014-06-09 11:36:49 -07:00
|
|
|
$button->setText(pht('Show All Tags'));
|
2014-01-20 13:12:30 -08:00
|
|
|
$button->setTag('a');
|
|
|
|
$button->setIcon($icon);
|
|
|
|
$button->setHref($drequest->generateURI(
|
2014-05-13 14:08:21 -07:00
|
|
|
array(
|
|
|
|
'action' => 'tags',
|
|
|
|
)));
|
2014-01-20 13:12:30 -08:00
|
|
|
|
|
|
|
$header->addActionLink($button);
|
|
|
|
|
|
|
|
$panel->setHeader($header);
|
2015-05-22 08:22:25 -07:00
|
|
|
$panel->setTable($view);
|
2012-04-18 08:02:08 -07:00
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
2013-09-19 11:57:09 -07:00
|
|
|
private function buildActionList(PhabricatorRepository $repository) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$view_uri = $this->getApplicationURI($repository->getCallsign().'/');
|
|
|
|
$edit_uri = $this->getApplicationURI($repository->getCallsign().'/edit/');
|
|
|
|
|
|
|
|
$view = id(new PhabricatorActionListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setObject($repository)
|
|
|
|
->setObjectURI($view_uri);
|
|
|
|
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$viewer,
|
|
|
|
$repository,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
|
|
|
$view->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Edit Repository'))
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-pencil')
|
2013-09-19 11:57:09 -07:00
|
|
|
->setHref($edit_uri)
|
|
|
|
->setWorkflow(!$can_edit)
|
|
|
|
->setDisabled(!$can_edit));
|
|
|
|
|
2013-12-05 11:59:33 -08:00
|
|
|
if ($repository->isHosted()) {
|
|
|
|
$callsign = $repository->getCallsign();
|
|
|
|
$push_uri = $this->getApplicationURI(
|
|
|
|
'pushlog/?repositories=r'.$callsign);
|
|
|
|
|
|
|
|
$view->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('View Push Logs'))
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-list-alt')
|
2013-12-05 11:59:33 -08:00
|
|
|
->setHref($push_uri));
|
|
|
|
}
|
|
|
|
|
2013-09-19 11:57:09 -07:00
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
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-26 19:59:57 -07:00
|
|
|
private function buildHistoryTable(
|
|
|
|
$history_results,
|
|
|
|
$history,
|
2015-09-10 19:28:49 -07: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-26 19:59:57 -07: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);
|
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
2014-01-09 08:51:57 -08:00
|
|
|
|
|
|
|
$icon = id(new PHUIIconView())
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIconFont('fa-list-alt');
|
2014-01-09 08:51:57 -08:00
|
|
|
|
|
|
|
$button = id(new PHUIButtonView())
|
|
|
|
->setText(pht('View Full History'))
|
|
|
|
->setHref($drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'history',
|
|
|
|
)))
|
|
|
|
->setTag('a')
|
|
|
|
->setIcon($icon);
|
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-26 19:59:57 -07:00
|
|
|
|
2014-01-07 11:57:37 -08:00
|
|
|
$panel = new PHUIObjectBoxView();
|
2014-01-09 08:51:57 -08:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(pht('Recent Commits'))
|
|
|
|
->addActionLink($button);
|
|
|
|
$panel->setHeader($header);
|
2015-05-19 23:14:22 -07: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-26 19:59:57 -07:00
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildBrowseTable(
|
|
|
|
$browse_results,
|
|
|
|
$browse_paths,
|
|
|
|
$browse_exception,
|
|
|
|
array $handles) {
|
|
|
|
|
2014-06-13 11:36:01 -07: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-26 19:59:57 -07: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'));
|
|
|
|
|
2014-01-07 11:57:37 -08:00
|
|
|
$browse_panel = new PHUIObjectBoxView();
|
2014-01-09 08:51:57 -08:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(pht('Repository'));
|
|
|
|
|
|
|
|
$icon = id(new PHUIIconView())
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIconFont('fa-folder-open');
|
2014-01-09 08:51:57 -08:00
|
|
|
|
|
|
|
$button = new PHUIButtonView();
|
|
|
|
$button->setText(pht('Browse Repository'));
|
|
|
|
$button->setTag('a');
|
|
|
|
$button->setIcon($icon);
|
|
|
|
$button->setHref($browse_uri);
|
|
|
|
|
|
|
|
$header->addActionLink($button);
|
|
|
|
$browse_panel->setHeader($header);
|
2014-05-13 14:08:21 -07:00
|
|
|
|
2015-07-03 10:19:43 -07:00
|
|
|
$locate_panel = null;
|
2014-05-13 14:08:21 -07: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')
|
|
|
|
->setLabel(pht('Locate File')));
|
2014-06-13 11:36:01 -07:00
|
|
|
$form_box = id(new PHUIBoxView())
|
|
|
|
->appendChild($form->buildLayoutView());
|
2015-05-22 08:22:25 -07:00
|
|
|
$locate_panel = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText('Locate File')
|
|
|
|
->appendChild($form_box);
|
2014-05-13 14:08:21 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 23:14:22 -07:00
|
|
|
$browse_panel->setTable($browse_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-26 19:59:57 -07:00
|
|
|
|
2015-05-22 08:22:25 -07:00
|
|
|
return array($locate_panel, $browse_panel);
|
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-26 19:59:57 -07:00
|
|
|
}
|
|
|
|
|
2014-01-30 11:42:10 -08:00
|
|
|
private function renderCloneCommand(
|
|
|
|
PhabricatorRepository $repository,
|
2013-11-01 17:35:43 -07:00
|
|
|
$uri,
|
|
|
|
$serve_mode = null,
|
|
|
|
$manage_uri = null) {
|
|
|
|
|
|
|
|
require_celerity_resource('diffusion-icons-css');
|
|
|
|
|
|
|
|
Javelin::initBehavior('select-on-click');
|
|
|
|
|
2014-01-30 11:42:10 -08:00
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
$command = csprintf(
|
2014-01-30 11:42:33 -08:00
|
|
|
'git clone %R',
|
2014-01-30 11:42:25 -08:00
|
|
|
$uri);
|
2014-01-30 11:42:10 -08:00
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$command = csprintf(
|
2014-01-30 11:42:33 -08:00
|
|
|
'hg clone %R',
|
2014-01-30 11:42:25 -08:00
|
|
|
$uri);
|
2014-01-30 11:42:10 -08:00
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
2014-02-28 13:04:41 -08:00
|
|
|
if ($repository->isHosted()) {
|
|
|
|
$command = csprintf(
|
|
|
|
'svn checkout %R %R',
|
|
|
|
$uri,
|
|
|
|
$repository->getCloneName());
|
|
|
|
} else {
|
|
|
|
$command = csprintf(
|
|
|
|
'svn checkout %R',
|
|
|
|
$uri);
|
|
|
|
}
|
2014-01-30 11:42:10 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-01 17:35:43 -07:00
|
|
|
$input = javelin_tag(
|
|
|
|
'input',
|
|
|
|
array(
|
|
|
|
'type' => 'text',
|
2014-01-30 11:42:10 -08:00
|
|
|
'value' => (string)$command,
|
2013-11-01 17:35:43 -07:00
|
|
|
'class' => 'diffusion-clone-uri',
|
|
|
|
'sigil' => 'select-on-click',
|
2013-12-20 13:47:25 -06:00
|
|
|
'readonly' => 'true',
|
2013-11-01 17:35:43 -07:00
|
|
|
));
|
|
|
|
|
|
|
|
$extras = array();
|
|
|
|
if ($serve_mode) {
|
|
|
|
if ($serve_mode === PhabricatorRepository::SERVE_READONLY) {
|
|
|
|
$extras[] = pht('(Read Only)');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($manage_uri) {
|
|
|
|
if ($this->getRequest()->getUser()->isLoggedIn()) {
|
|
|
|
$extras[] = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $manage_uri,
|
|
|
|
),
|
|
|
|
pht('Manage Credentials'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($extras) {
|
|
|
|
$extras = phutil_implode_html(' ', $extras);
|
|
|
|
$extras = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-clone-extras',
|
|
|
|
),
|
|
|
|
$extras);
|
|
|
|
}
|
|
|
|
|
|
|
|
return array($input, $extras);
|
|
|
|
}
|
|
|
|
|
2011-03-12 16:17:34 -08:00
|
|
|
}
|