Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92075415
DifferentialChangesetTestRenderer.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, 03:41
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Nov 19, 03:41 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22372438
Attached To
rPH Phabricator
DifferentialChangesetTestRenderer.php
View Options
<?php
abstract
class
DifferentialChangesetTestRenderer
extends
DifferentialChangesetRenderer
{
protected
function
renderChangeTypeHeader
(
$force
)
{
$changeset
=
$this
->
getChangeset
();
$old
=
nonempty
(
$changeset
->
getOldFile
(),
'-'
);
$away
=
nonempty
(
implode
(
', '
,
$changeset
->
getAwayPaths
()),
'-'
);
$ctype
=
$changeset
->
getChangeType
();
$ftype
=
$changeset
->
getFileType
();
$force
=
(
$force
?
'(forced)'
:
'(unforced)'
);
return
"CTYPE {$ctype} {$ftype} {$force}
\n
"
.
"{$old}
\n
"
.
"{$away}
\n
"
;
}
public
function
renderShield
(
$message
,
$force
=
'default'
)
{
return
"SHIELD ({$force}) {$message}
\n
"
;
}
protected
function
renderPropertyChangeHeader
()
{
$changeset
=
$this
->
getChangeset
();
$old
=
$changeset
->
getOldProperties
();
$new
=
$changeset
->
getNewProperties
();
if
(!
$old
&&
!
$new
)
{
return
null
;
}
$props
=
''
;
foreach
(
$old
as
$key
=>
$value
)
{
$props
.=
"P - {$key} {$value}~
\n
"
;
}
foreach
(
$new
as
$key
=>
$value
)
{
$props
.=
"P + {$key} {$value}~
\n
"
;
}
return
"PROPERTIES
\n
"
.
$props
;
}
public
function
renderTextChange
(
$range_start
,
$range_len
,
$rows
)
{
$out
=
array
();
$primitives
=
$this
->
buildPrimitives
(
$range_start
,
$range_len
);
foreach
(
$primitives
as
$p
)
{
$type
=
$p
[
'type'
];
switch
(
$type
)
{
case
'old'
:
case
'new'
:
$num
=
nonempty
(
$p
[
'line'
],
'-'
);
$render
=
$p
[
'render'
];
$htype
=
nonempty
(
$p
[
'htype'
],
'.'
);
// TODO: This should probably happen earlier, whenever we deal with
// \r and \t normalization?
$render
=
rtrim
(
$render
,
"
\r\n
"
);
$t
=
(
$type
==
'old'
)
?
'O'
:
'N'
;
$out
[]
=
"{$t} {$num} {$htype} {$render}~"
;
break
;
default
:
$out
[]
=
$type
;
break
;
}
}
$out
=
implode
(
"
\n
"
,
$out
).
"
\n
"
;
return
$out
;
}
public
function
renderFileChange
(
$old_file
=
null
,
$new_file
=
null
,
$id
=
0
,
$vs
=
0
)
{
throw
new
Exception
(
"Not implemented!"
);
}
}
Event Timeline
Log In to Comment