hgext/convert/hg.py
changeset 24395 216fa1ba9993
parent 24306 6ddc86eedc3b
child 25305 884ef09cf658
--- a/hgext/convert/hg.py	Thu Mar 19 17:36:17 2015 +0100
+++ b/hgext/convert/hg.py	Thu Mar 19 17:40:19 2015 +0100
@@ -132,9 +132,14 @@
             fp.write('%s %s\n' % (revid, s[1]))
         return fp.getvalue()
 
-    def putcommit(self, files, copies, parents, commit, source, revmap, full):
+    def putcommit(self, files, copies, parents, commit, source, revmap, full,
+                  cleanp2):
         files = dict(files)
+
         def getfilectx(repo, memctx, f):
+            if p2ctx and f in cleanp2 and f not in copies:
+                self.ui.debug('reusing %s from p2\n' % f)
+                return p2ctx[f]
             try:
                 v = files[f]
             except KeyError:
@@ -199,6 +204,9 @@
         while parents:
             p1 = p2
             p2 = parents.pop(0)
+            p2ctx = None
+            if p2 != nullid:
+                p2ctx = self.repo[p2]
             fileset = set(files)
             if full:
                 fileset.update(self.repo[p1])
@@ -382,9 +390,13 @@
         # getcopies() is also run for roots and before filtering so missing
         # revlogs are detected early
         copies = self.getcopies(ctx, parents, copyfiles)
+        cleanp2 = set()
+        if len(parents) == 2:
+            cleanp2.update(self.repo.status(parents[1].node(), ctx.node(),
+                                            clean=True).clean)
         changes = [(f, rev) for f in files if f not in self.ignored]
         changes.sort()
-        return changes, copies
+        return changes, copies, cleanp2
 
     def getcopies(self, ctx, parents, files):
         copies = {}