unidiff: punt on comparing empty files
authormpm@selenic.com
Sat, 07 May 2005 16:10:50 -0800
changeset 35 9197c26a414b
parent 34 8708c75da2ac
child 36 da28286bf6b7
unidiff: punt on comparing empty files
mercurial/mdiff.py
--- a/mercurial/mdiff.py	Sat May 07 11:37:28 2005 -0800
+++ b/mercurial/mdiff.py	Sat May 07 16:10:50 2005 -0800
@@ -3,9 +3,10 @@
 from cStringIO import StringIO
 
 def unidiff(a, b, fn):
+    if not a and not b: return ""
     a = a.splitlines(1)
     b = b.splitlines(1)
-    l = difflib.unified_diff(a, b, fn, fn)
+    l = list(difflib.unified_diff(a, b, fn, fn))
     return "".join(l)
 
 def textdiff(a, b):