From e92b1fee9f75cbfa71ed4dadf1828c9adc1a4a75 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 6 Apr 2011 19:06:00 -0700 Subject: [PATCH] Show child changes in last-modified view. --- .../query/history/base/DiffusionHistoryQuery.php | 6 ++++++ .../query/history/svn/DiffusionSvnHistoryQuery.php | 12 +++++++++++- .../diffusion/query/history/svn/__init__.php | 1 + .../svn/DiffusionSvnLastModifiedQuery.php | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php b/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php index 78e8eaf182..20f6923232 100644 --- a/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php +++ b/src/applications/diffusion/query/history/base/DiffusionHistoryQuery.php @@ -23,6 +23,7 @@ abstract class DiffusionHistoryQuery { private $offset = 0; protected $needDirectChanges; + protected $needChildChanges; final private function __construct() { // @@ -57,6 +58,11 @@ abstract class DiffusionHistoryQuery { return $this; } + final public function needChildChanges($child) { + $this->needChildChanges = $child; + 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 ac6f16fa10..34cc7a78da 100644 --- a/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php +++ b/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php @@ -35,6 +35,16 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery { $paths = ipull($paths, 'id', 'path'); $path_id = $paths['/'.trim($path, '/')]; + $filter_query = ''; + if ($this->needDirectChanges) { + if ($this->needChildChanges) { + $type = DifferentialChangeType::TYPE_CHILD; + $filter_query = 'AND (isDirect = 1 OR changeType = '.$type.')'; + } else { + $filter_query = 'AND (isDirect = 1)'; + } + } + $history_data = queryfx_all( $conn_r, 'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d @@ -46,7 +56,7 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery { $repository->getID(), $path_id, $commit ? $commit : 0x7FFFFFFF, - ($this->needDirectChanges ? 'AND isDirect = 1' : ''), + $filter_query, $this->getOffset(), $this->getLimit()); diff --git a/src/applications/diffusion/query/history/svn/__init__.php b/src/applications/diffusion/query/history/svn/__init__.php index 4c14b8da0f..485c9296d6 100644 --- a/src/applications/diffusion/query/history/svn/__init__.php +++ b/src/applications/diffusion/query/history/svn/__init__.php @@ -6,6 +6,7 @@ +phutil_require_module('phabricator', 'applications/differential/constants/changetype'); phutil_require_module('phabricator', 'applications/diffusion/data/pathchange'); phutil_require_module('phabricator', 'applications/diffusion/query/history/base'); phutil_require_module('phabricator', 'applications/repository/storage/commit'); diff --git a/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php index 3604c3a63a..513b72550b 100644 --- a/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php +++ b/src/applications/diffusion/query/lastmodified/svn/DiffusionSvnLastModifiedQuery.php @@ -27,7 +27,7 @@ final class DiffusionSvnLastModifiedQuery extends DiffusionLastModifiedQuery { $history_query = DiffusionHistoryQuery::newFromDiffusionRequest( $drequest); $history_query->setLimit(1); - + $history_query->needChildChanges(true); $history_query->needDirectChanges(true); $history_array = $history_query->loadHistory(); $history = reset($history_array);