From dbd91d681828293f183a8419b2a6b77dd4121899 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 25 Jan 2012 14:50:34 -0800 Subject: [PATCH] Allow differential.query to find accepted and committed revisions; fix a fatal Summary: - Expose existing 'committed' filter. - Add an 'accepted' filter. - Fix a fatal where $repository may not be defined (for diffs not linked to a repository). Test Plan: Ran accepted / committed queries. Viewed a previously fataling diff. Reviewers: btrahan, vrana, Makinde Reviewed By: Makinde CC: Koolvin, aran, epriestley Differential Revision: https://secure.phabricator.com/D1490 --- .../ConduitAPI_differential_query_Method.php | 2 ++ .../revision/DifferentialRevisionQuery.php | 17 +++++++++++++---- .../DifferentialChangesetListView.php | 2 +- .../herald/engine/engine/HeraldEngine.php | 2 -- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/applications/conduit/method/differential/query/ConduitAPI_differential_query_Method.php b/src/applications/conduit/method/differential/query/ConduitAPI_differential_query_Method.php index d1cd3891a7..bc32a69a58 100644 --- a/src/applications/conduit/method/differential/query/ConduitAPI_differential_query_Method.php +++ b/src/applications/conduit/method/differential/query/ConduitAPI_differential_query_Method.php @@ -32,6 +32,8 @@ class ConduitAPI_differential_query_Method extends ConduitAPIMethod { $status_types = array( DifferentialRevisionQuery::STATUS_ANY, DifferentialRevisionQuery::STATUS_OPEN, + DifferentialRevisionQuery::STATUS_ACCEPTED, + DifferentialRevisionQuery::STATUS_COMMITTED, ); $status_types = implode(', ', $status_types); diff --git a/src/applications/differential/query/revision/DifferentialRevisionQuery.php b/src/applications/differential/query/revision/DifferentialRevisionQuery.php index 33e7b6d650..db5f01606c 100644 --- a/src/applications/differential/query/revision/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/revision/DifferentialRevisionQuery.php @@ -34,10 +34,11 @@ final class DifferentialRevisionQuery { private $pathIDs = array(); - private $status = 'status-any'; - const STATUS_ANY = 'status-any'; - const STATUS_OPEN = 'status-open'; - const STATUS_COMMITTED = 'status-committed'; + private $status = 'status-any'; + const STATUS_ANY = 'status-any'; + const STATUS_OPEN = 'status-open'; + const STATUS_ACCEPTED = 'status-accepted'; + const STATUS_COMMITTED = 'status-committed'; private $authors = array(); private $ccs = array(); @@ -640,6 +641,14 @@ final class DifferentialRevisionQuery { ArcanistDifferentialRevisionStatus::ACCEPTED, )); break; + case self::STATUS_ACCEPTED: + $where[] = qsprintf( + $conn_r, + 'status IN (%Ld)', + array( + ArcanistDifferentialRevisionStatus::ACCEPTED, + )); + break; case self::STATUS_COMMITTED: $where[] = qsprintf( $conn_r, diff --git a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php index 020703f8a4..f1d0cb8234 100644 --- a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php +++ b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php @@ -139,7 +139,7 @@ class DifferentialChangesetListView extends AphrontView { $meta['rightURI'] = (string)$detail_uri->alter('view', 'new'); } - if ($this->user) { + if ($this->user && $repository) { $path = ltrim( $changeset->getAbsoluteRepositoryPath($this->diff, $repository), '/'); diff --git a/src/applications/herald/engine/engine/HeraldEngine.php b/src/applications/herald/engine/engine/HeraldEngine.php index b704e78542..9532a4862d 100644 --- a/src/applications/herald/engine/engine/HeraldEngine.php +++ b/src/applications/herald/engine/engine/HeraldEngine.php @@ -180,8 +180,6 @@ class HeraldEngine { implode(', ', $sql)); } } - - die("DERP"); } public function getTranscript() {