Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82420042
DrydockTestRepositoryOperation.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
Wed, Sep 11, 07:46
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Sep 13, 07:46 (2 d)
Engine
blob
Format
Raw Data
Handle
20697849
Attached To
rPH Phabricator
DrydockTestRepositoryOperation.php
View Options
<?php
final
class
DrydockTestRepositoryOperation
extends
DrydockRepositoryOperationType
{
const
OPCONST
=
'test'
;
public
function
getOperationDescription
(
DrydockRepositoryOperation
$operation
,
PhabricatorUser
$viewer
)
{
return
pht
(
'Test Configuration'
);
}
public
function
getOperationCurrentStatus
(
DrydockRepositoryOperation
$operation
,
PhabricatorUser
$viewer
)
{
$repository
=
$operation
->
getRepository
();
switch
(
$operation
->
getOperationState
())
{
case
DrydockRepositoryOperation
::
STATE_WAIT
:
return
pht
(
'Waiting to test configuration for %s...'
,
$repository
->
getMonogram
());
case
DrydockRepositoryOperation
::
STATE_WORK
:
return
pht
(
'Testing configuration for %s. This may take a moment if Drydock '
.
'has to clone the repository for the first time.'
,
$repository
->
getMonogram
());
case
DrydockRepositoryOperation
::
STATE_DONE
:
return
pht
(
'Success! Automation is configured properly and Drydock can '
.
'operate on %s.'
,
$repository
->
getMonogram
());
}
}
public
function
applyOperation
(
DrydockRepositoryOperation
$operation
,
DrydockInterface
$interface
)
{
$repository
=
$operation
->
getRepository
();
if
(
$repository
->
isGit
())
{
$interface
->
execx
(
'git status'
);
}
else
if
(
$repository
->
isHg
())
{
$interface
->
execx
(
'hg status'
);
}
else
if
(
$repository
->
isSVN
())
{
$interface
->
execx
(
'svn status'
);
}
else
{
throw
new
PhutilMethodNotImplementedException
();
}
}
}
Event Timeline
Log In to Comment