diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7fc1ec5e13..767e09800a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -133,6 +133,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_getcommitmessage_Method' => 'applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php', 'ConduitAPI_differential_getcommitpaths_Method' => 'applications/differential/conduit/ConduitAPI_differential_getcommitpaths_Method.php', 'ConduitAPI_differential_getdiff_Method' => 'applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php', + 'ConduitAPI_differential_getrawdiff_Method' => 'applications/differential/conduit/ConduitAPI_differential_getrawdiff_Method.php', 'ConduitAPI_differential_getrevision_Method' => 'applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php', 'ConduitAPI_differential_getrevisioncomments_Method' => 'applications/differential/conduit/ConduitAPI_differential_getrevisioncomments_Method.php', 'ConduitAPI_differential_markcommitted_Method' => 'applications/differential/conduit/ConduitAPI_differential_markcommitted_Method.php', @@ -2223,6 +2224,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_getcommitmessage_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getdiff_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_getrawdiff_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getrevision_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getrevisioncomments_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_markcommitted_Method' => 'ConduitAPIMethod', @@ -3003,7 +3005,11 @@ phutil_register_library_map(array( 'PhabricatorApplicationUninstallController' => 'PhabricatorApplicationsController', 'PhabricatorApplicationXHProf' => 'PhabricatorApplication', 'PhabricatorApplicationsController' => 'PhabricatorController', - 'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController', + 'PhabricatorApplicationsListController' => + array( + 0 => 'PhabricatorApplicationsController', + 1 => 'PhabricatorApplicationSearchResultsControllerInterface', + ), 'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController', 'PhabricatorAuditComment' => diff --git a/src/applications/differential/conduit/ConduitAPI_differential_getrawdiff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_getrawdiff_Method.php new file mode 100644 index 0000000000..99e6515a06 --- /dev/null +++ b/src/applications/differential/conduit/ConduitAPI_differential_getrawdiff_Method.php @@ -0,0 +1,53 @@ + 'required diffID', + ); + } + + public function defineReturnType() { + return 'nonempty string'; + } + + public function defineErrorTypes() { + return array( + 'ERR_NOT_FOUND' => pht('Diff not found.'), + ); + } + + protected function execute(ConduitAPIRequest $request) { + $diff_id = $request->getValue('diffID'); + + $viewer = $request->getUser(); + + $diff = id(new DifferentialDiffQuery()) + ->withIDs(array($diff_id)) + ->setViewer($viewer) + ->executeOne(); + + if (!$diff) { + throw new ConduitException('ERR_NOT_FOUND'); + } + + $changesets = $diff->loadChangesets(); + foreach ($changesets as $changeset) { + $changeset->attachHunks( + $changeset->loadHunks()); + } + + $renderer = new DifferentialRawDiffRenderer(); + $renderer->setChangesets($changesets); + $renderer->setViewer($viewer); + $renderer->setFormat('git'); + return $renderer->buildPatch(); + + } +}