Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893752
DifferentialRawDiffRenderer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
DifferentialRawDiffRenderer.php
View Options
<?php
final
class
DifferentialRawDiffRenderer
extends
Phobject
{
private
$changesets
;
private
$format
=
'unified'
;
private
$viewer
;
private
$byteLimit
;
public
function
setFormat
(
$format
)
{
$this
->
format
=
$format
;
return
$this
;
}
public
function
getFormat
(
)
{
return
$this
->
format
;
}
public
function
setChangesets
(
array
$changesets
)
{
assert_instances_of
(
$changesets
,
'DifferentialChangeset'
)
;
$this
->
changesets
=
$changesets
;
return
$this
;
}
public
function
getChangesets
(
)
{
return
$this
->
changesets
;
}
public
function
setViewer
(
PhabricatorUser
$viewer
)
{
$this
->
viewer
=
$viewer
;
return
$this
;
}
public
function
getViewer
(
)
{
return
$this
->
viewer
;
}
public
function
setByteLimit
(
$byte_limit
)
{
$this
->
byteLimit
=
$byte_limit
;
return
$this
;
}
public
function
getByteLimit
(
)
{
return
$this
->
byteLimit
;
}
public
function
buildPatch
(
)
{
$diff
=
new
DifferentialDiff
(
)
;
$diff
->
attachChangesets
(
$this
->
getChangesets
(
)
)
;
$raw_changes
=
$diff
->
buildChangesList
(
)
;
$changes
=
array
(
)
;
foreach
(
$raw_changes
as
$changedict
)
{
$changes
[
]
=
ArcanistDiffChange
::
newFromDictionary
(
$changedict
)
;
}
$viewer
=
$this
->
getViewer
(
)
;
$loader
=
id
(
new
PhabricatorFileBundleLoader
(
)
)
->
setViewer
(
$viewer
)
;
$bundle
=
ArcanistBundle
::
newFromChanges
(
$changes
)
;
$bundle
->
setLoadFileDataCallback
(
array
(
$loader
,
'loadFileData'
)
)
;
$byte_limit
=
$this
->
getByteLimit
(
)
;
if
(
$byte_limit
)
{
$bundle
->
setByteLimit
(
$byte_limit
)
;
}
$format
=
$this
->
getFormat
(
)
;
switch
(
$format
)
{
case
'git'
:
return
$bundle
->
toGitPatch
(
)
;
case
'unified'
:
default
:
return
$bundle
->
toUnifiedDiff
(
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:00 (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127639
Default Alt Text
DifferentialRawDiffRenderer.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment