Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15285602
D18267.id43931.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
14 KB
Referenced Files
None
Subscribers
None
D18267.id43931.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,7 +9,7 @@
'names' => array(
'conpherence.pkg.css' => 'e68cf1fa',
'conpherence.pkg.js' => 'b5b51108',
- 'core.pkg.css' => 'f1c7630f',
+ 'core.pkg.css' => 'c0a7ecfd',
'core.pkg.js' => '5d80e0db',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '45951e9e',
@@ -75,7 +75,7 @@
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
- 'rsrc/css/application/diffusion/diffusion.css' => '8d01932f',
+ 'rsrc/css/application/diffusion/diffusion.css' => '67bd971b',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
'rsrc/css/application/flag/flag.css' => 'bba8f811',
@@ -127,7 +127,7 @@
'rsrc/css/layout/phabricator-source-code-view.css' => 'aea41829',
'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494',
'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68',
- 'rsrc/css/phui/button/phui-button.css' => '022581b4',
+ 'rsrc/css/phui/button/phui-button.css' => '3a744520',
'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893',
'rsrc/css/phui/calendar/phui-calendar-list.css' => '576be600',
'rsrc/css/phui/calendar/phui-calendar-month.css' => '21154caf',
@@ -571,7 +571,7 @@
'differential-revision-history-css' => '0e8eb855',
'differential-revision-list-css' => 'f3c47d33',
'differential-table-of-contents-css' => 'ae4b7a55',
- 'diffusion-css' => '8d01932f',
+ 'diffusion-css' => '67bd971b',
'diffusion-icons-css' => '0c15255e',
'diffusion-readme-css' => '419dd5b6',
'diffusion-repository-css' => 'ee6f20ec',
@@ -825,7 +825,7 @@
'phui-big-info-view-css' => 'd13afcde',
'phui-box-css' => '745e881d',
'phui-button-bar-css' => 'f1ff5494',
- 'phui-button-css' => '022581b4',
+ 'phui-button-css' => '3a744520',
'phui-button-simple-css' => '8e1baf68',
'phui-calendar-css' => 'f1ddf11c',
'phui-calendar-day-css' => '572b1893',
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -4,7 +4,7 @@
private $historyFuture;
private $browseFuture;
- private $tagFuture;
+ private $branchButton = null;
private $branchFuture;
public function shouldAllowPublic() {
@@ -53,15 +53,24 @@
// 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());
+ $default = $repository->getDefaultBranch();
+ if ($default != $drequest->getBranch()) {
+ $empty_title = pht('No Such Branch');
+ $empty_message = pht(
+ 'There is no branch named "%s" in this repository.',
+ $drequest->getBranch());
+ } else {
+ $empty_title = pht('No Default Branch');
+ $empty_message = pht(
+ 'The configured default branch "%s" is not 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.
+ $any_commit = null;
if (!$page_has_content) {
$any_commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
@@ -81,6 +90,8 @@
if ($page_has_content) {
$content = $this->buildNormalContent($drequest);
} else {
+ // If we have a commit somewhere, find branches.
+ $this->buildNormalContent($drequest);
$content = id(new PHUIInfoView())
->setTitle($empty_title)
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
@@ -110,7 +121,7 @@
$bar = id(new PHUILeftRightView())
->setLeft($locate_file)
- ->setRight($clone_button)
+ ->setRight(array($this->branchButton, $clone_button))
->addClass('diffusion-action-bar');
$view = id(new PHUITwoColumnView())
@@ -142,33 +153,50 @@
$request = $this->getRequest();
$repository = $drequest->getRepository();
- $commit = $drequest->getCommit();
- $path = $drequest->getPath();
+ $commit = null;
+ try {
+ $commit = $drequest->getCommit();
+ $path = $drequest->getPath();
+ } catch (Exception $ex) {
+ // Move forward anyways
+ }
- $this->historyFuture = $this->callConduitMethod(
- 'diffusion.historyquery',
- array(
- 'commit' => $commit,
- 'path' => $path,
- 'offset' => 0,
- 'limit' => 15,
- ));
+ $futures = array();
+ if ($commit) {
+ $this->historyFuture = $this->callConduitMethod(
+ 'diffusion.historyquery',
+ array(
+ 'commit' => $commit,
+ 'path' => $path,
+ 'offset' => 0,
+ 'limit' => 15,
+ ));
+ $futures[] = $this->historyFuture;
- $browse_pager = id(new PHUIPagerView())
- ->readFromRequest($request);
+ $browse_pager = id(new PHUIPagerView())
+ ->readFromRequest($request);
- $this->browseFuture = $this->callConduitMethod(
- 'diffusion.browsequery',
- array(
- 'commit' => $commit,
- 'path' => $path,
- 'limit' => $browse_pager->getPageSize() + 1,
- ));
+ $this->browseFuture = $this->callConduitMethod(
+ 'diffusion.browsequery',
+ array(
+ 'commit' => $commit,
+ 'path' => $path,
+ 'limit' => $browse_pager->getPageSize() + 1,
+ ));
+ $futures[] = $this->branchFuture;
+ }
+
+ if ($this->needBranchFuture()) {
+ $branch_limit = $this->getBranchLimit();
+ $this->branchFuture = $this->callConduitMethod(
+ 'diffusion.branchquery',
+ array(
+ 'closed' => false,
+ 'limit' => $branch_limit + 1,
+ ));
+ $futures[] = $this->branchFuture;
+ }
- $futures = array(
- $this->historyFuture,
- $this->browseFuture,
- );
$futures = array_filter($futures);
$futures = new FutureIterator($futures);
foreach ($futures as $future) {
@@ -178,79 +206,93 @@
$phids = array();
$content = array();
- try {
- $history_results = $this->historyFuture->resolve();
- $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;
+ if ($commit) {
+ try {
+ $history_results = $this->historyFuture->resolve();
+ $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;
+ }
}
}
+ $history_exception = null;
+ } catch (Exception $ex) {
+ $history_results = null;
+ $history = null;
+ $history_exception = $ex;
}
- $history_exception = null;
- } catch (Exception $ex) {
- $history_results = null;
- $history = null;
- $history_exception = $ex;
- }
- try {
- $browse_results = $this->browseFuture->resolve();
- $browse_results = DiffusionBrowseResultSet::newFromConduit(
- $browse_results);
-
- $browse_paths = $browse_results->getPaths();
- $browse_paths = $browse_pager->sliceResults($browse_paths);
-
- 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;
+ try {
+ $browse_results = $this->browseFuture->resolve();
+ $browse_results = DiffusionBrowseResultSet::newFromConduit(
+ $browse_results);
+
+ $browse_paths = $browse_results->getPaths();
+ $browse_paths = $browse_pager->sliceResults($browse_paths);
+
+ 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;
+ }
}
}
+
+ $browse_exception = null;
+ } catch (Exception $ex) {
+ $browse_results = null;
+ $browse_paths = null;
+ $browse_exception = $ex;
}
- $browse_exception = null;
- } catch (Exception $ex) {
- $browse_results = null;
- $browse_paths = null;
- $browse_exception = $ex;
- }
+ $phids = array_keys($phids);
+ $handles = $this->loadViewerHandles($phids);
- $phids = array_keys($phids);
- $handles = $this->loadViewerHandles($phids);
+ if ($browse_results) {
+ $readme = $this->renderDirectoryReadme($browse_results);
+ } else {
+ $readme = null;
+ }
- if ($browse_results) {
- $readme = $this->renderDirectoryReadme($browse_results);
- } else {
- $readme = null;
- }
+ $content[] = $this->buildBrowseTable(
+ $browse_results,
+ $browse_paths,
+ $browse_exception,
+ $handles,
+ $browse_pager);
- $content[] = $this->buildBrowseTable(
- $browse_results,
- $browse_paths,
- $browse_exception,
- $handles,
- $browse_pager);
+ $content[] = $this->buildHistoryTable(
+ $history_results,
+ $history,
+ $history_exception);
- $content[] = $this->buildHistoryTable(
- $history_results,
- $history,
- $history_exception);
+ if ($readme) {
+ $content[] = $readme;
+ }
- if ($readme) {
- $content[] = $readme;
+ }
+
+ try {
+ $branch_button = $this->buildBranchList($drequest);
+ $this->branchButton = $branch_button;
+ } catch (Exception $ex) {
+ if (!$repository->isImporting()) {
+ $content[] = $this->renderStatusMessage(
+ pht('Unable to Load Branches'),
+ $ex->getMessage());
+ }
}
return $content;
@@ -375,6 +417,67 @@
return $panel;
}
+ private function buildBranchList(DiffusionRequest $drequest) {
+ $viewer = $this->getViewer();
+
+ if (!$this->needBranchFuture()) {
+ return null;
+ }
+
+ $branches = $this->branchFuture->resolve();
+ if (!$branches) {
+ return null;
+ }
+
+ $limit = $this->getBranchLimit();
+ $more_branches = (count($branches) > $limit);
+ $branches = array_slice($branches, 0, $limit);
+
+ $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
+
+ $actions = id(new PhabricatorActionListView())
+ ->setViewer($viewer);
+
+ foreach ($branches as $branch) {
+ $branch_uri = $drequest->generateURI(
+ array(
+ 'action' => 'browse',
+ 'branch' => $branch->getShortname(),
+ ));
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setName($branch->getShortname())
+ ->setIcon('fa-code-fork')
+ ->setHref($branch_uri));
+ }
+
+ if ($more_branches) {
+ $more_uri = $drequest->generateURI(
+ array(
+ 'action' => 'branches',
+ ));
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setType(PhabricatorActionView::TYPE_DIVIDER));
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('See More Branches'))
+ ->setIcon('fa-external-link')
+ ->setHref($more_uri));
+ }
+
+ $button = id(new PHUIButtonView())
+ ->setText(pht('Branch: %s', $drequest->getBranch()))
+ ->setTag('a')
+ ->addClass('mmr')
+ ->setIcon('fa-code-fork')
+ ->setColor(PHUIButtonView::GREY)
+ ->setDropdown(true)
+ ->setDropdownMenu($actions);
+
+ return $button;
+ }
+
private function buildLocateFile() {
$request = $this->getRequest();
$viewer = $request->getUser();
@@ -457,7 +560,17 @@
->setPager($pager);
}
- private function getTagLimit() {
+ private function needBranchFuture() {
+ $drequest = $this->getDiffusionRequest();
+
+ if ($drequest->getBranch() === null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private function getBranchLimit() {
return 15;
}
diff --git a/webroot/rsrc/css/application/diffusion/diffusion.css b/webroot/rsrc/css/application/diffusion/diffusion.css
--- a/webroot/rsrc/css/application/diffusion/diffusion.css
+++ b/webroot/rsrc/css/application/diffusion/diffusion.css
@@ -16,6 +16,23 @@
margin-bottom: 16px;
}
+.device-phone .diffusion-action-bar {
+ display: block;
+}
+
+.device-phone .diffusion-action-bar .phui-lr-container {
+ display: block;
+}
+
+.device-phone .diffusion-action-bar .phui-lr-container .phui-left-view {
+ display: block;
+}
+
+.device-phone .diffusion-action-bar .phui-lr-container .phui-right-view {
+ padding-top: 12px;
+ display: block;
+}
+
.diffusion-profile-locate .phui-form-view {
margin: 0;
padding: 0;
diff --git a/webroot/rsrc/css/phui/button/phui-button.css b/webroot/rsrc/css/phui/button/phui-button.css
--- a/webroot/rsrc/css/phui/button/phui-button.css
+++ b/webroot/rsrc/css/phui/button/phui-button.css
@@ -265,6 +265,14 @@
right: 10px;
}
+.phui-button-text {
+ display: inline-block;
+}
+
+.dropdown .phui-button-text {
+ margin-right: 16px;
+}
+
.button.has-icon .phui-button-text {
margin-left: 16px;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 2:44 PM (20 h, 41 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225812
Default Alt Text
D18267.id43931.diff (14 KB)
Attached To
Mode
D18267: Add a branch selector to Diffusion
Attached
Detach File
Event Timeline
Log In to Comment