From c5b33528659a78b53d3413ed5a86440594561bc3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 18 Feb 2011 22:28:03 -0800 Subject: [PATCH] differential.getcommitpaths Summary: Test Plan: Reviewers: CC: --- src/__phutil_library_map__.php | 2 + ...API_differential_getcommitpaths_Method.php | 64 +++++++++++++++++++ .../differential/getcommitpaths/__init__.php | 17 +++++ 3 files changed, 83 insertions(+) create mode 100644 src/applications/conduit/method/differential/getcommitpaths/ConduitAPI_differential_getcommitpaths_Method.php create mode 100644 src/applications/conduit/method/differential/getcommitpaths/__init__.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 99e5e17146..bb60425fd9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -68,6 +68,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_createrevision_Method' => 'applications/conduit/method/differential/createrevision', 'ConduitAPI_differential_find_Method' => 'applications/conduit/method/differential/find', 'ConduitAPI_differential_getcommitmessage_Method' => 'applications/conduit/method/differential/getcommitmessage', + 'ConduitAPI_differential_getcommitpaths_Method' => 'applications/conduit/method/differential/getcommitpaths', 'ConduitAPI_differential_getdiff_Method' => 'applications/conduit/method/differential/getdiff', 'ConduitAPI_differential_markcommitted_Method' => 'applications/conduit/method/differential/markcommitted', 'ConduitAPI_differential_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage', @@ -331,6 +332,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_createrevision_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_find_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getcommitmessage_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getdiff_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_markcommitted_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', diff --git a/src/applications/conduit/method/differential/getcommitpaths/ConduitAPI_differential_getcommitpaths_Method.php b/src/applications/conduit/method/differential/getcommitpaths/ConduitAPI_differential_getcommitpaths_Method.php new file mode 100644 index 0000000000..8511b8fd54 --- /dev/null +++ b/src/applications/conduit/method/differential/getcommitpaths/ConduitAPI_differential_getcommitpaths_Method.php @@ -0,0 +1,64 @@ + 'required int', + ); + } + + public function defineReturnType() { + return 'nonempty list'; + } + + public function defineErrorTypes() { + return array( + 'ERR_NOT_FOUND' => 'No such revision exists.', + ); + } + + protected function execute(ConduitAPIRequest $request) { + $id = $request->getValue('revision_id'); + + $revision = id(new DifferentialRevision())->load($id); + if (!$revision) { + throw new ConduitException('ERR_NOT_FOUND'); + } + + $paths = array(); + $diff = id(new DifferentialDiff())->loadOneWhere( + 'revisionID = %d ORDER BY id DESC limit 1', + $revision->getID()); + + $diff->attachChangesets($diff->loadChangesets()); + + foreach ($diff->getChangesets() as $changeset) { + $paths[] = $changeset->getFilename(); + } + + return $paths; + } + +} diff --git a/src/applications/conduit/method/differential/getcommitpaths/__init__.php b/src/applications/conduit/method/differential/getcommitpaths/__init__.php new file mode 100644 index 0000000000..40d08b5b7f --- /dev/null +++ b/src/applications/conduit/method/differential/getcommitpaths/__init__.php @@ -0,0 +1,17 @@ +