Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99230844
ConduitAPI_differential_getrawdiff_Method.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, Jan 22, 14:40
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 24, 14:40 (2 d)
Engine
blob
Format
Raw Data
Handle
23738800
Attached To
rPH Phabricator
ConduitAPI_differential_getrawdiff_Method.php
View Options
<?php
final
class
ConduitAPI_differential_getrawdiff_Method
extends
ConduitAPI_differential_Method
{
public
function
getMethodDescription
()
{
return
pht
(
"Retrieve a raw diff"
);
}
public
function
defineParamTypes
()
{
return
array
(
'diffID'
=>
'required diffID'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty string'
;
}
public
function
defineErrorTypes
()
{
return
array
(
'ERR_NOT_FOUND'
=>
pht
(
'Diff not found.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$diff_id
=
$request
->
getValue
(
'diffID'
);
$viewer
=
$request
->
getUser
();
$diff
=
id
(
new
DifferentialDiffQuery
())
->
withIDs
(
array
(
$diff_id
))
->
setViewer
(
$viewer
)
->
executeOne
();
if
(!
$diff
)
{
throw
new
ConduitException
(
'ERR_NOT_FOUND'
);
}
$changesets
=
$diff
->
loadChangesets
();
foreach
(
$changesets
as
$changeset
)
{
$changeset
->
attachHunks
(
$changeset
->
loadHunks
());
}
$renderer
=
new
DifferentialRawDiffRenderer
();
$renderer
->
setChangesets
(
$changesets
);
$renderer
->
setViewer
(
$viewer
);
$renderer
->
setFormat
(
'git'
);
return
$renderer
->
buildPatch
();
}
}
Event Timeline
Log In to Comment