diff --git a/src/applications/diffusion/controller/change/DiffusionChangeController.php b/src/applications/diffusion/controller/change/DiffusionChangeController.php index 1f9a836eb5..5876d479ed 100644 --- a/src/applications/diffusion/controller/change/DiffusionChangeController.php +++ b/src/applications/diffusion/controller/change/DiffusionChangeController.php @@ -26,6 +26,11 @@ class DiffusionChangeController extends DiffusionController { $diff_query = DiffusionDiffQuery::newFromDiffusionRequest($drequest); $changeset = $diff_query->loadChangeset(); + if (!$changeset) { + // TODO: Refine this. + return new Aphront404Response(); + } + $changeset_view = new DifferentialChangesetListView(); $changeset_view->setChangesets(array($changeset)); $changeset_view->setRenderURI( diff --git a/src/applications/diffusion/controller/change/__init__.php b/src/applications/diffusion/controller/change/__init__.php index 8c5bc94613..1d9dfc8af6 100644 --- a/src/applications/diffusion/controller/change/__init__.php +++ b/src/applications/diffusion/controller/change/__init__.php @@ -6,6 +6,7 @@ +phutil_require_module('phabricator', 'aphront/response/404'); phutil_require_module('phabricator', 'applications/differential/view/changesetlistview'); phutil_require_module('phabricator', 'applications/diffusion/controller/base'); phutil_require_module('phabricator', 'applications/diffusion/query/diff/base'); diff --git a/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php b/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php index 8cb1c1d719..78e8eaf182 100644 --- a/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php +++ b/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php @@ -22,6 +22,8 @@ abstract class DiffusionHistoryQuery { private $limit = 100; private $offset = 0; + protected $needDirectChanges; + final private function __construct() { // } @@ -50,6 +52,11 @@ abstract class DiffusionHistoryQuery { return $query; } + final public function needDirectChanges($direct) { + $this->needDirectChanges = $direct; + return $this; + } + final protected function getRequest() { return $this->request; } diff --git a/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php b/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php index f2a4f6b070..ac6f16fa10 100644 --- a/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php +++ b/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php @@ -35,19 +35,18 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery { $paths = ipull($paths, 'id', 'path'); $path_id = $paths['/'.trim($path, '/')]; - // TODO: isDirect junk, but note that we need indirect events for the - // svnlastmodified query! - $history_data = queryfx_all( $conn_r, 'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d AND commitSequence <= %d + %Q ORDER BY commitSequence DESC LIMIT %d, %d', PhabricatorRepository::TABLE_PATHCHANGE, $repository->getID(), $path_id, $commit ? $commit : 0x7FFFFFFF, + ($this->needDirectChanges ? 'AND isDirect = 1' : ''), $this->getOffset(), $this->getLimit()); diff --git a/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php index e0ba0207e7..3604c3a63a 100644 --- a/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php +++ b/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php @@ -27,6 +27,8 @@ final class DiffusionSvnLastModifiedQuery extends DiffusionLastModifiedQuery { $history_query = DiffusionHistoryQuery::newFromDiffusionRequest( $drequest); $history_query->setLimit(1); + + $history_query->needDirectChanges(true); $history_array = $history_query->loadHistory(); $history = reset($history_array);