638009474a3b

api: Don't crash if the diff has no lines (in case of merge for instance)
[view raw] [browse files]
author Benoît Allard <benoit@aeteurope.nl>
date Mon, 23 Jan 2012 15:01:27 +0100
parents 78819a1b530e
children 9030dc9517cf b0bcc35b016a 627b1d4e0fa3 fc97fabaf28d 3e5dfa8a94ef
branches/tags (none)
files review/api.py

Changes

--- a/review/api.py	Mon Jul 18 13:34:36 2011 -0400
+++ b/review/api.py	Mon Jan 23 15:01:27 2012 +0100
@@ -572,6 +572,10 @@
             diff_opts.git = True
             d = patch.diff(self.target, node1, node2, match=m, opts=diff_opts)
 
+            if not d:
+                # there might be no diff for the current file (merge)
+                continue
+
             # patch.diff will give us back a generator with two items
             # the first is the diff --git header, which we don't care about
             d.next()