diff --git a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php index 7842884e2c..a8a9769d00 100644 --- a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php @@ -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 diff --git a/src/applications/diffusion/controller/base/DiffusionController.php b/src/applications/diffusion/controller/base/DiffusionController.php index 132a9854be..0d5fa73c0c 100644 --- a/src/applications/diffusion/controller/base/DiffusionController.php +++ b/src/applications/diffusion/controller/base/DiffusionController.php @@ -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(); diff --git a/src/applications/diffusion/controller/base/__init__.php b/src/applications/diffusion/controller/base/__init__.php index d154ac6eba..2be5bb582b 100644 --- a/src/applications/diffusion/controller/base/__init__.php +++ b/src/applications/diffusion/controller/base/__init__.php @@ -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'); diff --git a/src/applications/diffusion/controller/browse/DiffusionBrowseController.php b/src/applications/diffusion/controller/browse/DiffusionBrowseController.php index f67b9cfaf2..859f6f71b8 100644 --- a/src/applications/diffusion/controller/browse/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/browse/DiffusionBrowseController.php @@ -122,6 +122,8 @@ class DiffusionBrowseController extends DiffusionController { $content[] = $browse_panel; } + $content[] = $this->buildOpenRevisions(); + $nav = $this->buildSideNav('browse', false); $nav->appendChild($content); diff --git a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php index 3dacdd7fce..a0ac7b1a1d 100644 --- a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php @@ -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(