Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92141206
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
Sun, Nov 17, 17:45
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Nov 19, 17:45 (2 d)
Engine
blob
Format
Raw Data
Handle
22382373
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