diff mercurial/patch.py @ 5482:e5eedd74e70f

Use both the from and to name in mdiff.unidiff. This fixes a compatibility issue with git diffs. * * *
author Dustin Sallings <dustin@spy.net>
date Thu, 01 Nov 2007 12:17:59 -0700
parents 003d1f174fe1
children 777996744942
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Nov 01 12:05:14 2007 +0100
+++ b/mercurial/patch.py	Thu Nov 01 12:17:59 2007 -0700
@@ -1230,6 +1230,7 @@
             to = getfilectx(f, ctx1).data()
         if f not in removed:
             tn = getfilectx(f, ctx2).data()
+        a, b = f, f
         if opts.git:
             def gitmode(x, l):
                 return l and '120000' or (x and '100755' or '100644')
@@ -1238,7 +1239,6 @@
                     header.append('old mode %s\n' % omode)
                     header.append('new mode %s\n' % nmode)
 
-            a, b = f, f
             if f in added:
                 mode = gitmode(execf2(f), linkf2(f))
                 if f in copied:
@@ -1278,7 +1278,7 @@
                 text = mdiff.unidiff(to, date1,
                                     # ctx2 date may be dynamic
                                     tn, util.datestr(ctx2.date()),
-                                    f, r, opts=opts)
+                                    a, b, r, opts=opts)
             if text or len(header) > 1:
                 fp.write(''.join(header))
             fp.write(text)