Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F998045
DiffusionExistsQueryConduitAPIMethod.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
DiffusionExistsQueryConduitAPIMethod.php
View Options
<?php
final
class
DiffusionExistsQueryConduitAPIMethod
extends
DiffusionQueryConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'diffusion.existsquery'
;
}
public
function
getMethodDescription
()
{
return
'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'
);
list
(
$info
)
=
$repository
->
execxRemoteCommand
(
'info %s'
,
$repository
->
getRemoteURI
());
$exists
=
false
;
$matches
=
null
;
if
(
preg_match
(
'/^Revision: (
\d
+)$/m'
,
$info
,
$matches
))
{
$base_revision
=
$matches
[
1
];
$exists
=
$base_revision
>=
$commit
;
}
return
$exists
;
}
protected
function
getMercurialResult
(
ConduitAPIRequest
$request
)
{
$repository
=
$this
->
getDiffusionRequest
()->
getRepository
();
$commit
=
$request
->
getValue
(
'commit'
);
list
(
$err
,
$stdout
)
=
$repository
->
execLocalCommand
(
'id --rev %s'
,
$commit
);
return
!
$err
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Jun 19, 2:48 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
222653
Default Alt Text
DiffusionExistsQueryConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment