Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F539460
DiffusionRefsQueryConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DiffusionRefsQueryConduitAPIMethod.php
View Options
<?php
final
class
DiffusionRefsQueryConduitAPIMethod
extends
DiffusionQueryConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'diffusion.refsquery'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Query a git repository for ref information at a specific commit.'
);
}
protected
function
defineReturnType
()
{
return
'array'
;
}
protected
function
defineCustomParamTypes
()
{
return
array
(
'commit'
=>
'required string'
,
);
}
protected
function
getGitResult
(
ConduitAPIRequest
$request
)
{
$drequest
=
$this
->
getDiffusionRequest
();
$repository
=
$drequest
->
getRepository
();
$commit
=
$request
->
getValue
(
'commit'
);
list
(
$stdout
)
=
$repository
->
execxLocalCommand
(
'log -n 1 %s %s --'
,
'--format=%d'
,
gitsprintf
(
'%s'
,
$commit
));
// %d, gives a weird output format
// similar to (remote/one, remote/two, remote/three)
$refs
=
trim
(
$stdout
,
"()
\n
"
);
if
(!
$refs
)
{
return
array
();
}
$refs
=
explode
(
','
,
$refs
);
$refs
=
array_map
(
'trim'
,
$refs
);
$ref_links
=
array
();
foreach
(
$refs
as
$ref
)
{
$ref_links
[]
=
array
(
'ref'
=>
$ref
,
'href'
=>
$drequest
->
generateURI
(
array
(
'action'
=>
'browse'
,
'branch'
=>
$ref
,
)),
);
}
return
$ref_links
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 9:11 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120280
Default Alt Text
DiffusionRefsQueryConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment