Add support for monotone's diff header

This commit is contained in:
Thomas Keller 2010-05-01 00:56:48 +02:00
parent c49a8204e0
commit 15a2bd90b3

View File

@ -71,6 +71,14 @@ class IDF_Diff
$current_chunk = 0; $current_chunk = 0;
$indiff = true; $indiff = true;
continue; continue;
} else if (0 === strpos($line, '=========')) {
$current_file = self::getMtnFile($this->lines[$i+1]);
$files[$current_file] = array();
$files[$current_file]['chunks'] = array();
$files[$current_file]['chunks_def'] = array();
$current_chunk = 0;
$indiff = true;
continue;
} else if (0 === strpos($line, 'Index: ')) { } else if (0 === strpos($line, 'Index: ')) {
$current_file = self::getSvnFile($line); $current_file = self::getSvnFile($line);
$files[$current_file] = array(); $files[$current_file] = array();
@ -133,6 +141,12 @@ class IDF_Diff
return substr(trim($line), 7); return substr(trim($line), 7);
} }
public static function getMtnFile($line)
{
preg_match("/^[+-]{3} ([^\t]+)/", $line, $m);
return $m[1];
}
/** /**
* Return the html version of a parsed diff. * Return the html version of a parsed diff.
*/ */