From c33b2715198c92212865503763004f44accd13c4 Mon Sep 17 00:00:00 2001 From: Julien Issler Date: Tue, 30 Dec 2008 18:21:04 +0100 Subject: [PATCH] Fixed issue 96, errors when parsing a Mercurial diff. --- src/IDF/Diff.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index baa90ff..4b7f8b2 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -55,8 +55,14 @@ class IDF_Diff $files[$current_file]['chunks_def'] = array(); $current_chunk = 0; continue; - } - if (0 === strpos($line, 'Index: ')) { + } else if (preg_match('#^diff -r [^\s]+ -r [^\s]+ (.+)$#', $line, $matches)) { + $current_file = $matches[1]; + $files[$current_file] = array(); + $files[$current_file]['chunks'] = array(); + $files[$current_file]['chunks_def'] = array(); + $current_chunk = 0; + continue; + } else if (0 === strpos($line, 'Index: ')) { $current_file = self::getSvnFile($line); $files[$current_file] = array(); $files[$current_file]['chunks'] = array(); @@ -327,4 +333,4 @@ class IDF_Diff return Pluf_Template::markSafe($out); } -} \ No newline at end of file +}