Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14004281
D7451.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D7451.diff
View Options
Index: src/applications/diffusion/controller/DiffusionRepositoryController.php
===================================================================
--- src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -198,61 +198,62 @@
}
private function buildBranchListTable(DiffusionRequest $drequest) {
- if ($drequest->getBranch() !== null) {
- $limit = 15;
+ $viewer = $this->getRequest()->getUser();
- $branches = DiffusionBranchInformation::newFromConduit(
- $this->callConduitWithDiffusionRequest(
- 'diffusion.branchquery',
- array(
- 'limit' => $limit
- )));
- if (!$branches) {
- return null;
- }
+ if ($drequest->getBranch() === null) {
+ return null;
+ }
- $more_branches = (count($branches) > $limit);
- $branches = array_slice($branches, 0, $limit);
+ $limit = 15;
- $commits = id(new PhabricatorAuditCommitQuery())
- ->withIdentifiers(
- $drequest->getRepository()->getID(),
- mpull($branches, 'getHeadCommitIdentifier'))
- ->needCommitData(true)
- ->execute();
+ $branches = DiffusionBranchInformation::newFromConduit(
+ $this->callConduitWithDiffusionRequest(
+ 'diffusion.branchquery',
+ array(
+ 'limit' => $limit + 1,
+ )));
+ if (!$branches) {
+ return null;
+ }
- $table = new DiffusionBranchTableView();
- $table->setDiffusionRequest($drequest);
- $table->setBranches($branches);
- $table->setCommits($commits);
- $table->setUser($this->getRequest()->getUser());
+ $more_branches = (count($branches) > $limit);
+ $branches = array_slice($branches, 0, $limit);
- $panel = new AphrontPanelView();
- $panel->setHeader(pht('Branches'));
- $panel->setNoBackground();
+ $commits = id(new DiffusionCommitQuery())
+ ->setViewer($viewer)
+ ->withIdentifiers(mpull($branches, 'getHeadCommitIdentifier'))
+ ->withRepositoryIDs(array($drequest->getRepository()->getID()))
+ ->execute();
- if ($more_branches) {
- $panel->setCaption(pht('Showing %d branches.', $limit));
- }
+ $table = new DiffusionBranchTableView();
+ $table->setDiffusionRequest($drequest);
+ $table->setBranches($branches);
+ $table->setCommits($commits);
+ $table->setUser($this->getRequest()->getUser());
- $panel->addButton(
- phutil_tag(
- 'a',
- array(
- 'href' => $drequest->generateURI(
- array(
- 'action' => 'branches',
- )),
- 'class' => 'grey button',
- ),
- pht("Show All Branches \xC2\xBB")));
-
- $panel->appendChild($table);
+ $panel = new AphrontPanelView();
+ $panel->setHeader(pht('Branches'));
+ $panel->setNoBackground();
- return $panel;
+ if ($more_branches) {
+ $panel->setCaption(pht('Showing %d branches.', $limit));
}
- return null;
+ $panel->addButton(
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => $drequest->generateURI(
+ array(
+ 'action' => 'branches',
+ )),
+ 'class' => 'grey button',
+ ),
+ pht("Show All Branches \xC2\xBB")));
+
+ $panel->appendChild($table);
+
+ return $panel;
}
private function buildTagListTable(DiffusionRequest $drequest) {
Index: src/applications/diffusion/query/DiffusionCommitQuery.php
===================================================================
--- src/applications/diffusion/query/DiffusionCommitQuery.php
+++ src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -8,6 +8,9 @@
private $phids;
private $defaultRepository;
private $identifierMap;
+ private $repositoryIDs;
+
+ private $needCommitData;
/**
* Load commits by partial or full identifiers, e.g. "rXab82393", "rX1234",
@@ -34,6 +37,11 @@
return $this;
}
+ public function withRepositoryIDs(array $repository_ids) {
+ $this->repositoryIDs = $repository_ids;
+ return $this;
+ }
+
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
@@ -44,6 +52,11 @@
return $this;
}
+ public function needCommitData($need) {
+ $this->needCommitData = $need;
+ return $this;
+ }
+
public function getIdentifierMap() {
if ($this->identifierMap === null) {
throw new Exception(
@@ -71,7 +84,7 @@
return $table->loadAllFromArray($data);
}
- public function willFilterPage(array $commits) {
+ protected function willFilterPage(array $commits) {
$repository_ids = mpull($commits, 'getRepositoryID', 'getRepositoryID');
$repos = id(new PhabricatorRepositoryQuery())
->setViewer($this->getViewer())
@@ -131,6 +144,22 @@
return $commits;
}
+ protected function didFilterPage(array $commits) {
+
+ if ($this->needCommitData) {
+ $data = id(new PhabricatorRepositoryCommitData())->loadAllWhere(
+ 'commitID in (%Ld)',
+ mpull($commits, 'getID'));
+ $data = mpull($data, null, 'getCommitID');
+ foreach ($commits as $commit) {
+ $commit_data = idx($data, $commit->getID());
+ $commit->attachCommitData($commit_data);
+ }
+ }
+
+ return $commits;
+ }
+
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
@@ -237,6 +266,13 @@
$this->phids);
}
+ if ($this->repositoryIDs) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'repositoryID IN (%Ld)',
+ $this->repositoryIDs);
+ }
+
return $this->formatWhereClause($where);
}
Index: src/applications/diffusion/view/DiffusionBranchTableView.php
===================================================================
--- src/applications/diffusion/view/DiffusionBranchTableView.php
+++ src/applications/diffusion/view/DiffusionBranchTableView.php
@@ -25,10 +25,7 @@
foreach ($this->branches as $branch) {
$commit = idx($this->commits, $branch->getHeadCommitIdentifier());
if ($commit) {
- $details = $commit->getCommitData()->getCommitMessage();
- $details = idx(explode("\n", $details), 0);
- $details = substr($details, 0, 80);
-
+ $details = $commit->getSummary();
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
} else {
$datetime = null;
@@ -61,7 +58,6 @@
$branch->getHeadCommitIdentifier()),
$datetime,
AphrontTableView::renderSingleDisplayLine($details),
- // TODO: etc etc
);
if ($branch->getName() == $current_branch) {
$rowc[] = 'highlighted';
Index: src/applications/repository/storage/PhabricatorRepositoryCommit.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -81,7 +81,8 @@
$this->getID());
}
- public function attachCommitData(PhabricatorRepositoryCommitData $data) {
+ public function attachCommitData(
+ PhabricatorRepositoryCommitData $data = null) {
$this->commitData = $data;
return $this;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 27, 5:50 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6739822
Default Alt Text
D7451.diff (7 KB)
Attached To
Mode
D7451: Clean up Diffusion branch query a bit
Attached
Detach File
Event Timeline
Log In to Comment