# HG changeset patch # User Alexis S. L. Carvalho # Date 2007-06-03 17:38:52 # Node ID b79cdb7f05979bd6c008bf06e3125509a1f55345 # Parent fc20fa9f2dfdc6ff2e4f7d39fab5f48848cb60c0 patch.diff: avoid calling workingctx().manifest() Right now, to generate the manifest of the working dir, we have to perform a full walk of the working dir, which will be very slow, especially if we're interested in only a small part of it. Since we use the manifest only to find out the mode of files for git patches, manually build an execf function to do it. This should fix issue567. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -495,9 +495,12 @@ def diff(repo, node1=None, node2=None, f if node2: ctx2 = context.changectx(repo, node2) + execf2 = ctx2.manifest().execf else: ctx2 = context.workingctx(repo) - man2 = ctx2.manifest() + execf2 = util.execfunc(repo.root, None) + if execf2 is None: + execf2 = ctx2.parents()[0].manifest().copy().execf # returns False if there was no rename between ctx1 and ctx2 # returns None if the file was created between ctx1 and ctx2 @@ -563,7 +566,7 @@ def diff(repo, node1=None, node2=None, f a, b = f, f if f in added: - mode = gitmode(man2.execf(f)) + mode = gitmode(execf2(f)) if f in copied: a = copied[f] omode = gitmode(man1.execf(a)) @@ -588,7 +591,7 @@ def diff(repo, node1=None, node2=None, f header.append('deleted file mode %s\n' % mode) else: omode = gitmode(man1.execf(f)) - nmode = gitmode(man2.execf(f)) + nmode = gitmode(execf2(f)) addmodehdr(header, omode, nmode) if util.binary(to) or util.binary(tn): dodiff = 'binary'