diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 1aded6c0a3..458b0a6ee0 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -88,6 +88,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage', 'ConduitAPI_differential_setdiffproperty_Method' => 'applications/conduit/method/differential/setdiffproperty', 'ConduitAPI_differential_updaterevision_Method' => 'applications/conduit/method/differential/updaterevision', + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'applications/conduit/method/differential/updatetaskrevisionassoc', 'ConduitAPI_diffusion_getcommits_Method' => 'applications/conduit/method/diffusion/getcommits', 'ConduitAPI_file_upload_Method' => 'applications/conduit/method/file/upload', 'ConduitAPI_path_getowners_Method' => 'applications/conduit/method/path/getowners', @@ -540,6 +541,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_updaterevision_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'ConduitAPIMethod', 'ConduitAPI_diffusion_getcommits_Method' => 'ConduitAPIMethod', 'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod', 'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod', diff --git a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php index 4bee4284c5..4ffb6087fb 100644 --- a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php @@ -83,7 +83,7 @@ class PhabricatorConduitConsoleController id(new AphrontFormTextControl()) ->setLabel($param) ->setName("params[{$param}]") - ->setCaption($desc)); + ->setCaption(phutil_escape_html($desc))); } $form diff --git a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php index fc4b986f1e..1c00674718 100644 --- a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php +++ b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php @@ -34,7 +34,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { return array( 'query' => 'required enum<'.$types.'>', - 'guids' => 'required nonempty list', + 'guids' => 'required nonempty list', ); } @@ -49,14 +49,18 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { protected function execute(ConduitAPIRequest $request) { $query = $request->getValue('query'); - $phids = $request->getValue('guids'); + $guids = $request->getValue('guids'); + + $results = array(); + if (!$guids) { + return $results; + } $revisions = id(new DifferentialRevisionListData( $query, - (array)$phids)) + (array)$guids)) ->loadRevisions(); - $results = array(); foreach ($revisions as $revision) { $diff = $revision->loadActiveDiff(); if (!$diff) { @@ -64,6 +68,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { } $results[] = array( 'id' => $revision->getID(), + 'phid' => $revision->getPHID(), 'name' => $revision->getTitle(), 'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus( $revision->getStatus()), diff --git a/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php b/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php new file mode 100644 index 0000000000..45a3a6829b --- /dev/null +++ b/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php @@ -0,0 +1,71 @@ + 'required nonempty string', + 'orig_rev_phids' => 'required list', + 'new_rev_phids' => 'required list', + ); + } + + public function defineReturnType() { + return 'void'; + } + + public function defineErrorTypes() { + return array( + 'ERR_NO_TASKATTACHER_DEFINED' => 'No task attacher defined.', + ); + } + + protected function execute(ConduitAPIRequest $request) { + $task_phid = $request->getValue('task_phid'); + $orig_rev_phids = $request->getValue('orig_rev_phids'); + if (empty($orig_rev_phids)) { + $orig_rev_phids = array(); + } + + $new_rev_phids = $request->getValue('new_rev_phids'); + if (empty($new_rev_phids)) { + $new_rev_phids = array(); + } + + $task_class = PhabricatorEnv::getEnvConfig( + 'differential.attach-task-class'); + if (!$task_class) { + throw new ConduitException('ERR_NO_TASKATTACHER_DEFINED'); + } + + PhutilSymbolLoader::loadClass($task_class); + $task_attacher = newv($task_class, array()); + $task_attacher->updateTaskRevisionAssoc( + $task_phid, + $orig_rev_phids, + $new_rev_phids); + } + +} + diff --git a/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php b/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php new file mode 100644 index 0000000000..0ad02cea4f --- /dev/null +++ b/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php @@ -0,0 +1,17 @@ +generateActionLinks($revision, $target)); } + $whitespace = $request->getStr( + 'whitespace', + DifferentialChangesetParser::WHITESPACE_IGNORE_TRAILING + ); + $revision_detail->setActions($actions); $revision_detail->setUser($user); @@ -169,24 +174,26 @@ class DifferentialRevisionViewController extends DifferentialController { $comment_view->setUser($user); $comment_view->setTargetDiff($target); + $changeset_view = new DifferentialChangesetListView(); + $changeset_view->setChangesets($visible_changesets); + $changeset_view->setEditable(true); + $changeset_view->setRevision($revision); + $changeset_view->setVsMap($vs_map); + $changeset_view->setWhitespace($whitespace); + $diff_history = new DifferentialRevisionUpdateHistoryView(); $diff_history->setDiffs($diffs); $diff_history->setSelectedVersusDiffID($diff_vs); $diff_history->setSelectedDiffID($target->getID()); - $diff_history->setSelectedWhitespace($request->getStr('whitespace')); + $diff_history->setSelectedWhitespace($whitespace); $toc_view = new DifferentialDiffTableOfContentsView(); $toc_view->setChangesets($changesets); $toc_view->setStandaloneViewLink(empty($visible_changesets)); $toc_view->setVsMap($vs_map); $toc_view->setRevisionID($revision->getID()); + $toc_view->setWhitespace($whitespace); - $changeset_view = new DifferentialChangesetListView(); - $changeset_view->setChangesets($visible_changesets); - $changeset_view->setEditable(true); - $changeset_view->setRevision($revision); - $changeset_view->setVsMap($vs_map); - $changeset_view->setWhitespace($request->getStr('whitespace')); $draft = id(new PhabricatorDraft())->loadOneWhere( 'authorPHID = %s AND draftKey = %s', @@ -604,273 +611,3 @@ class DifferentialRevisionViewController extends DifferentialController { ->replace(); } } -/* - - - protected function getSandcastleURI(Diff $diff) { - $uri = $this->getDiffProperty($diff, 'facebook:sandcastle_uri'); - if (!$uri) { - $uri = $diff->getSandboxURL(); - } - return $uri; - } - - protected function getDiffProperty(Diff $diff, $property, $default = null) { - $diff_id = $diff->getID(); - if (empty($this->diffProperties[$diff_id])) { - $props = id(new DifferentialDiffProperty()) - ->loadAllWhere('diffID = %s', $diff_id); - $dict = array_pull($props, 'getData', 'getName'); - $this->diffProperties[$diff_id] = $dict; - } - return idx($this->diffProperties[$diff_id], $property, $default); - } - - $diff_table->appendChild( - - - - {id(