Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96577027
DiffusionExistsQueryConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Dec 28, 10:23
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 30, 10:23 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23210081
Attached To
rPH Phabricator
DiffusionExistsQueryConduitAPIMethod.php
View Options
<?php
final
class
DiffusionExistsQueryConduitAPIMethod
extends
DiffusionQueryConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'diffusion.existsquery'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Determine if code exists in a version control system.'
);
}
protected
function
defineReturnType
()
{
return
'bool'
;
}
protected
function
defineCustomParamTypes
()
{
return
array
(
'commit'
=>
'required string'
,
);
}
protected
function
getGitResult
(
ConduitAPIRequest
$request
)
{
$repository
=
$this
->
getDiffusionRequest
()->
getRepository
();
$commit
=
$request
->
getValue
(
'commit'
);
list
(
$err
,
$merge_base
)
=
$repository
->
execLocalCommand
(
'cat-file -t %s'
,
$commit
);
return
!
$err
;
}
protected
function
getSVNResult
(
ConduitAPIRequest
$request
)
{
$repository
=
$this
->
getDiffusionRequest
()->
getRepository
();
$commit
=
$request
->
getValue
(
'commit'
);
$refs
=
id
(
new
DiffusionCachedResolveRefsQuery
())
->
setRepository
(
$repository
)
->
withRefs
(
array
(
$commit
))
->
execute
();
return
(
bool
)
$refs
;
}
protected
function
getMercurialResult
(
ConduitAPIRequest
$request
)
{
$repository
=
$this
->
getDiffusionRequest
()->
getRepository
();
$commit
=
$request
->
getValue
(
'commit'
);
list
(
$err
,
$stdout
)
=
$repository
->
execLocalCommand
(
'id --rev %s'
,
hgsprintf
(
'%s'
,
$commit
));
return
!
$err
;
}
}
Event Timeline
Log In to Comment