Differential D10279 Diff 24758 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
Show First 20 Lines • Show All 1,821 Lines • ▼ Show 20 Lines | if ($count > $max) { | ||||
$filenames = array_slice($filenames, 0, $max); | $filenames = array_slice($filenames, 0, $max); | ||||
$filenames[] = pht('(%d more files...)', ($count - $max)); | $filenames[] = pht('(%d more files...)', ($count - $max)); | ||||
} | } | ||||
return implode("\n", $filenames); | return implode("\n", $filenames); | ||||
} | } | ||||
private function renderPatchHTMLForMail($patch) { | private function renderPatchHTMLForMail($patch) { | ||||
$patch_html_lines = array(); | |||||
foreach (phutil_split_lines($patch) as $line) { | |||||
$len = strlen($line); | |||||
$color = null; | |||||
if ($len >= 1 && $line[0] == '+') { | |||||
$color = 'green'; | |||||
} else if ($len >= 1 && $line[0] == '-') { | |||||
$color = 'red'; | |||||
} else if ($len >= 2 && substr($line, 0, 2) == '@@') { | |||||
$color = 'purple'; | |||||
} | |||||
$attrib = array(); | |||||
if ($color) { | |||||
$attrib['style'] = "color:{$color};"; | |||||
} | |||||
$patch_html_lines[] = phutil_tag('span', $attrib, $line); | |||||
} | |||||
return phutil_tag('pre', | return phutil_tag('pre', | ||||
array('style' => 'font-family: monospace;'), $patch); | array('style' => 'font-family: monospace;'), | ||||
$patch_html_lines); | |||||
} | } | ||||
private function renderPatchForMail(DifferentialDiff $diff) { | private function renderPatchForMail(DifferentialDiff $diff) { | ||||
$format = PhabricatorEnv::getEnvConfig('metamta.differential.patch-format'); | $format = PhabricatorEnv::getEnvConfig('metamta.differential.patch-format'); | ||||
$patch = id(new DifferentialRawDiffRenderer()) | $patch = id(new DifferentialRawDiffRenderer()) | ||||
->setViewer($this->getActor()) | ->setViewer($this->getActor()) | ||||
->setFormat($format) | ->setFormat($format) | ||||
Show All 11 Lines |