Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4938689
DifferentialSetBaseCommitConduitAPIMethod.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
epriestley
May 4 2017, 7:59 PM
2017-05-04 19:59:41 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
DifferentialSetBaseCommitConduitAPIMethod.php
View Options
<?php
final
class
DifferentialSetBaseCommitConduitAPIMethod
extends
DifferentialConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'differential.hack.setbasecommit'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'(Temporary Hack) Set the base commit of a diff.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'diffID'
=>
'required id'
,
'commit'
=>
'required string'
,
);
}
protected
function
defineReturnType
()
{
return
'null'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$diff_id
=
$request
->
getValue
(
'diffID'
);
if
(!
strlen
(
$diff_id
))
{
throw
new
Exception
(
pht
(
'To select a diff to affect, provide a "diffID".'
));
}
$diff
=
id
(
new
DifferentialDiffQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$diff_id
))
->
executeOne
();
if
(!
$diff
)
{
throw
new
Exception
(
pht
(
'No diff exists with ID "%s".'
,
$diff_id
));
}
$commit
=
$request
->
getValue
(
'commit'
);
if
(!
strlen
(
$commit
))
{
throw
new
Exception
(
pht
(
'Provide a "commit" to identify which commit to set as '
.
'the base.'
));
}
$diff
->
setSourceControlBaseRevision
(
$commit
)
->
save
();
return
null
;
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
640569
Default Alt Text
DifferentialSetBaseCommitConduitAPIMethod.php (1 KB)
Attached To
Mode
P2047 DifferentialSetBaseCommitConduitAPIMethod.php
Attached
Detach File
Event Timeline
Log In to Comment