--- a/mercurial/patch.py Thu Jun 26 13:46:33 2008 -0500
+++ b/mercurial/patch.py Thu Jun 26 13:46:34 2008 -0500
@@ -1193,16 +1193,6 @@
return
ctx2 = repo.changectx(node2)
- if node2:
- execf2 = ctx2.manifest().execf
- linkf2 = ctx2.manifest().linkf
- else:
- execf2 = util.execfunc(repo.root, None)
- linkf2 = util.linkfunc(repo.root, None)
- if execf2 is None:
- mc = ctx2.parents()[0].manifest().copy()
- execf2 = mc.execf
- linkf2 = mc.linkf
if repo.ui.quiet:
r = None
@@ -1219,6 +1209,8 @@
all.sort()
gone = {}
+ gitmode = {'l': '120000', 'x': '100755', '': '100644'}
+
for f in all:
to = None
tn = None
@@ -1230,18 +1222,16 @@
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')
def addmodehdr(header, omode, nmode):
if omode != nmode:
header.append('old mode %s\n' % omode)
header.append('new mode %s\n' % nmode)
if f in added:
- mode = gitmode(execf2(f), linkf2(f))
+ mode = gitmode[ctx2.flags(f)]
if f in copy:
a = copy[f]
- omode = gitmode(man1.execf(a), man1.linkf(a))
+ omode = gitmode[man1.flags(a)]
addmodehdr(header, omode, mode)
if a in removed and a not in gone:
op = 'rename'
@@ -1260,11 +1250,11 @@
if f in copy and copy[f] in added and copy[copy[f]] == f:
dodiff = False
else:
- mode = gitmode(man1.execf(f), man1.linkf(f))
- header.append('deleted file mode %s\n' % mode)
+ header.append('deleted file mode %s\n' %
+ gitmode[man1.flags(f)])
else:
- omode = gitmode(man1.execf(f), man1.linkf(f))
- nmode = gitmode(execf2(f), linkf2(f))
+ omode = gitmode[man1.flags(f)]
+ nmode = gitmode[ctx2.flags(f)]
addmodehdr(header, omode, nmode)
if util.binary(to) or util.binary(tn):
dodiff = 'binary'