when a "---" line is parsed, wait to see "+++" before anything else
authorOlivier Matz <olivier.matz@6wind.com>
Fri, 15 Jun 2012 13:34:17 +0000 (15:34 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Thu, 9 Aug 2012 18:03:39 +0000 (20:03 +0200)
Make it possible to work in case there are empty lines between ---
and +++. (used for processing the output provided by Python's
difflib which leads to an empty line between --- and +++)

Signed-off-by: Sergey Satskiy <sergey.satskiy@gmail.com>
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
diff2html.py

index 6e2751e..d573d8f 100644 (file)
@@ -20,6 +20,7 @@
 #
 # Authors: Olivier MATZ <zer0@droids-corp.org>
 #          Alan De Smet <adesmet@cs.wisc.edu>
+#          Sergey Satskiy <sergey.satskiy@gmail.com>
 #
 # Inspired by diff2html.rb from Dave Burt <dave (at) burt.id.au>
 # (mainly for html theme)
@@ -308,10 +309,12 @@ def parse_input(input_file, output_file,
         if m:
             empty_buffer(output_file)
             file1 = m.groups()[0]
-            l = input_file.readline()
-            m = re.match('^\+\+\+ ([^\s]*)', l)
-            if m:
-                file2 = m.groups()[0]
+            while True:
+                l = input_file.readline()
+                m = re.match('^\+\+\+ ([^\s]*)', l)
+                if m:
+                    file2 = m.groups()[0]
+                    break
             add_filename(file1, file2, output_file)
             hunk_off1, hunk_size1, hunk_off2, hunk_size2 = 0, 0, 0, 0
             continue