Support branch offset/limit in Mercurial

Summary:
  - Support offset/limit as added by D2442, for Mercurial.
  - We just list everything and slice, no clear way to do better and this isn't a major perf issue.
  - No clear way to easily get by-update sorting, we can implement this by looking up revs if someone asks.
  - Bury some of the Git implementation details inside the Git query.

Test Plan:
  - Looked at a Git repo, clicked "View All Branches".
  - Looked at a Hg repo, clicked "View All Branches".
  - Limited page size to 1, made sure it limited properly.

Reviewers: aurelijus, btrahan, vrana

Reviewed By: aurelijus

CC: aran

Differential Revision: https://secure.phabricator.com/D2453
This commit is contained in:
epriestley
2012-05-10 14:18:49 -07:00
parent 70e5ef92cf
commit d24c81c5e2
4 changed files with 33 additions and 17 deletions

View File

@@ -32,8 +32,7 @@ final class DiffusionBranchTableController extends DiffusionController {
// TODO: Add support for branches that contain commit
$query = DiffusionBranchQuery::newFromDiffusionRequest($drequest);
$query->setOffset($pager->getOffset());
// we add 2 here, because of removed HEAD branch
$query->setLimit($pager->getPageSize() + 2);
$query->setLimit($pager->getPageSize() + 1);
$branches = $query->loadBranches();
$branches = $pager->sliceResults($branches);