mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Show open Differential revisions in Diffusion browse views
Summary: Still some rough edges, but this adds a table of open revisions to Diffusion. See T262. I'll make this a little better (e.g., "see all.." instead of arbitrary 10 cap, or maybe move to top-level nav?) but I think I have to refactor some other stuff first. This should let us root out any major issues, at least. NOTE: You must associate Arcanist Projects with Repositories (in Repositories -> Arcanist Projects -> Edit) for this to work! Also made paths include all parent paths so that browse views of directories will work. Test Plan: Uploaded a diff which affected "/blah", it appeared when browsing "/" and "/blah". Reviewers: jungejason, nh, tuomaspelkonen, aran Reviewed By: jungejason CC: aran, jungejason Differential Revision: 979
This commit is contained in:
parent
91bf3e96c9
commit
8ce5dd31f6
5 changed files with 59 additions and 2 deletions
|
@ -773,13 +773,23 @@ class DifferentialRevisionEditor {
|
|||
$paths[] = $path_prefix.'/'.$changeset->getFileName();
|
||||
}
|
||||
|
||||
$path_map = id(new DiffusionPathIDQuery($paths))->loadPathIDs($paths);
|
||||
// Mark this as also touching all parent paths, so you can see all pending
|
||||
// changes to any file within a directory.
|
||||
$all_paths = array();
|
||||
foreach ($paths as $local) {
|
||||
foreach (DiffusionPathIDQuery::expandPathToRoot($local) as $path) {
|
||||
$all_paths[$path] = true;
|
||||
}
|
||||
}
|
||||
$all_paths = array_keys($all_paths);
|
||||
|
||||
$path_map = id(new DiffusionPathIDQuery($all_paths))->loadPathIDs();
|
||||
|
||||
$table = new DifferentialAffectedPath();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
|
||||
$sql = array();
|
||||
foreach ($paths as $path) {
|
||||
foreach ($all_paths as $path) {
|
||||
$path_id = idx($path_map, $path);
|
||||
if (!$path_id) {
|
||||
// Don't bother creating these, it probably means we're either adding
|
||||
|
|
|
@ -108,6 +108,44 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
return $crumbs;
|
||||
}
|
||||
|
||||
protected function buildOpenRevisions() {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
$path = $drequest->getPath();
|
||||
|
||||
$path_map = id(new DiffusionPathIDQuery(array($path)))->loadPathIDs();
|
||||
$path_id = idx($path_map, $path);
|
||||
if (!$path_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$revisions = id(new DifferentialRevisionQuery())
|
||||
->withPath($repository->getID(), $path_id)
|
||||
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
|
||||
->setOrder(DifferentialRevisionQuery::ORDER_PATH_MODIFIED)
|
||||
->setLimit(10)
|
||||
->needRelationships(true)
|
||||
->execute();
|
||||
|
||||
if (!$revisions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$view = id(new DifferentialRevisionListView())
|
||||
->setRevisions($revisions)
|
||||
->setUser($this->getRequest()->getUser());
|
||||
|
||||
$phids = $view->getRequiredHandlePHIDs();
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
||||
$view->setHandles($handles);
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Pending Differential Revisions');
|
||||
$panel->appendChild($view);
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function buildCrumbList(array $spec = array()) {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
|
||||
|
|
|
@ -8,10 +8,15 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
||||
phutil_require_module('phabricator', 'applications/base/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/differential/query/revision');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/revisionlist');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/query/pathid/base');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/request/base');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/view/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'view/layout/crumbs');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
phutil_require_module('phabricator', 'view/layout/sidenav');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
|
@ -122,6 +122,8 @@ class DiffusionBrowseController extends DiffusionController {
|
|||
$content[] = $browse_panel;
|
||||
}
|
||||
|
||||
$content[] = $this->buildOpenRevisions();
|
||||
|
||||
$nav = $this->buildSideNav('browse', false);
|
||||
$nav->appendChild($content);
|
||||
|
||||
|
|
|
@ -117,10 +117,12 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
));
|
||||
$content[] = $view_select_panel;
|
||||
$content[] = $corpus;
|
||||
$content[] = $this->buildOpenRevisions();
|
||||
|
||||
$nav = $this->buildSideNav('browse', true);
|
||||
$nav->appendChild($content);
|
||||
|
||||
|
||||
$basename = basename($this->getDiffusionRequest()->getPath());
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
|
|
Loading…
Reference in a new issue