mercurial/mdiff.py
changeset 5482 e5eedd74e70f
parent 5367 7530334bf301
child 5863 3d1f9dcecdea
--- a/mercurial/mdiff.py	Thu Nov 01 12:05:14 2007 +0100
+++ b/mercurial/mdiff.py	Thu Nov 01 12:17:59 2007 -0700
@@ -59,11 +59,11 @@
         text = re.sub('\n+', '', text)
     return text
 
-def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
+def unidiff(a, ad, b, bd, fn1, fn2, r=None, opts=defaultopts):
     def datetag(date, addtab=True):
         if not opts.git and not opts.nodates:
             return '\t%s\n' % date
-        if addtab and ' ' in fn:
+        if addtab and ' ' in fn1:
             return '\t\n'
         return '\n'
 
@@ -76,29 +76,29 @@
             return md5.new(v).digest()
         if a and b and len(a) == len(b) and h(a) == h(b):
             return ""
-        l = ['Binary file %s has changed\n' % fn]
+        l = ['Binary file %s has changed\n' % fn1]
     elif not a:
         b = splitnewlines(b)
         if a is None:
             l1 = '--- /dev/null%s' % datetag(epoch, False)
         else:
-            l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
-        l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
+            l1 = "--- %s%s" % ("a/" + fn1, datetag(ad))
+        l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd))
         l3 = "@@ -0,0 +1,%d @@\n" % len(b)
         l = [l1, l2, l3] + ["+" + e for e in b]
     elif not b:
         a = splitnewlines(a)
-        l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
+        l1 = "--- %s%s" % ("a/" + fn1, datetag(ad))
         if b is None:
             l2 = '+++ /dev/null%s' % datetag(epoch, False)
         else:
-            l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
+            l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd))
         l3 = "@@ -1,%d +0,0 @@\n" % len(a)
         l = [l1, l2, l3] + ["-" + e for e in a]
     else:
         al = splitnewlines(a)
         bl = splitnewlines(b)
-        l = list(bunidiff(a, b, al, bl, "a/" + fn, "b/" + fn, opts=opts))
+        l = list(bunidiff(a, b, al, bl, "a/" + fn1, "b/" + fn2, opts=opts))
         if not l: return ""
         # difflib uses a space, rather than a tab
         l[0] = "%s%s" % (l[0][:-2], datetag(ad))
@@ -110,7 +110,7 @@
 
     if r:
         l.insert(0, "diff %s %s\n" %
-                    (' '.join(["-r %s" % rev for rev in r]), fn))
+                    (' '.join(["-r %s" % rev for rev in r]), fn1))
 
     return "".join(l)