3 abstract class DifferentialChangesetTestRenderer
4 extends DifferentialChangesetRenderer
{
6 protected function renderChangeTypeHeader($force) {
7 $changeset = $this->getChangeset();
9 $old = nonempty($changeset->getOldFile(), '-');
10 $current = nonempty($changeset->getFilename(), '-');
11 $away = nonempty(implode(', ', $changeset->getAwayPaths()), '-');
13 $ctype = $changeset->getChangeType();
14 $ftype = $changeset->getFileType();
15 $force = ($force ?
'(forced)' : '(unforced)');
17 return "CTYPE {$ctype} {$ftype} {$force}\n".
23 protected function renderUndershieldHeader() {
27 public function renderShield($message, $force = 'default') {
28 return "SHIELD ({$force}) {$message}\n";
31 protected function renderPropertyChangeHeader() {
32 $changeset = $this->getChangeset();
33 list($old, $new) = $this->getChangesetProperties($changeset);
35 foreach (array_keys($old) as $key) {
36 if ($old[$key] === idx($new, $key)) {
47 foreach ($old as $key => $value) {
48 $props .= "P - {$key} {$value}~\n";
50 foreach ($new as $key => $value) {
51 $props .= "P + {$key} {$value}~\n";
54 return "PROPERTIES\n".$props;
57 public function renderTextChange(
66 $primitives = $this->buildPrimitives($range_start, $range_len);
67 foreach ($primitives as $p) {
78 $num = nonempty($p['line'], '-');
79 $render = (string)$p['render'];
80 $htype = nonempty($p['htype'], '.');
82 // TODO: This should probably happen earlier, whenever we deal with
83 // \r and \t normalization?
84 $render = str_replace(
95 $render = str_replace(
97 '<span class="bright">',
99 '<span class="depth-out">',
100 '<span class="depth-in">',
110 $render = html_entity_decode($render, ENT_QUOTES
);
112 $t = ($type == 'old') ?
'O' : 'N';
114 $out[] = "{$t} {$num} {$htype} {$render}~";
117 $out[] = 'X <MISSING-CONTEXT>';
126 $out[] = 'O X <EMPTY>';
130 $out[] = 'N X <EMPTY>';
133 $out = implode("\n", $out)."\n";
134 return phutil_safe_html($out);