Add support for monotone's diff header

master
Thomas Keller 2010-05-01 00:56:48 +02:00
parent c49a8204e0
commit 15a2bd90b3
1 changed files with 21 additions and 7 deletions

View File

@ -71,6 +71,14 @@ class IDF_Diff
$current_chunk = 0;
$indiff = true;
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: ')) {
$current_file = self::getSvnFile($line);
$files[$current_file] = array();
@ -133,6 +141,12 @@ class IDF_Diff
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.
*/