Differential D25241 Diff 873 src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php
Show All 14 Lines | protected function defineReturnType() { | ||||
return 'list<dict>'; | return 'list<dict>'; | ||||
} | } | ||||
protected function defineCustomParamTypes() { | protected function defineCustomParamTypes() { | ||||
return array( | return array( | ||||
'closed' => 'optional bool', | 'closed' => 'optional bool', | ||||
'limit' => 'optional int', | 'limit' => 'optional int', | ||||
'offset' => 'optional int', | 'offset' => 'optional int', | ||||
'contains' => 'optional string', | 'contains' => 'optional string', | ||||
valerio.bozzolan: ✅ ↑ The `contains` parameter must be a `string` | |||||
'patterns' => 'optional list<string>', | 'patterns' => 'optional list<string>', | ||||
); | ); | ||||
} | } | ||||
protected function getGitResult(ConduitAPIRequest $request) { | protected function getGitResult(ConduitAPIRequest $request) { | ||||
$drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
$repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
$contains = $request->getValue('contains'); | $contains = $request->getValue('contains'); | ||||
if (strlen($contains)) { | if (phutil_nonempty_string($contains)) { | ||||
Not Done Inline Actions✅ It seems this is a Conduit API parameter that only accepts strings https://we.phorge.it/conduit/method/diffusion.branchquery/ This is useful to generate stuff like this: git branch --verbose --no-abbrev --contains $contains -- From git branch --help: With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit), --no-contains inverts it. With --merged, only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named commit will be listed. If the <commit> argument is missing it defaults to HEAD (i.e. the tip of the current branch). So, this indeed must be a string. valerio.bozzolan: ✅ It seems this is a Conduit API parameter that only accepts strings
https://we.phorge. | |||||
// See PHI958 (and, earlier, PHI720). If "patterns" are provided, pass | // See PHI958 (and, earlier, PHI720). If "patterns" are provided, pass | ||||
// them to "git branch ..." to let callers test for reachability from | // them to "git branch ..." to let callers test for reachability from | ||||
// particular branch heads. | // particular branch heads. | ||||
$patterns_argv = $request->getValue('patterns', array()); | $patterns_argv = $request->getValue('patterns', array()); | ||||
PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
array( | array( | ||||
'patterns' => $patterns_argv, | 'patterns' => $patterns_argv, | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ ↑ The contains parameter must be a string