changeset 27719:7ce8a13b8d77

convert: use manifest.diff() instead of ctx.status() mercurial_source.getchanges() seems to care about files whose nodeid has changed even if their contents has not (i.e. it has been reverted/backed out). The method uses ctx1.status(ctx2) to find differencing files. However, that method is currently broken and reports reverted changes as modified. In order to fix that method, we first need to rewrite getchanges() using manifest.diff(), which does report reverted files as modified (because it's about differences in the manifest, so about nodeids).
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 09 Jan 2016 22:58:10 -0800
parents 6e1fba0fe453
children 89f49813526c
files hgext/convert/hg.py
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Sun Jan 10 21:07:34 2016 -0800
+++ b/hgext/convert/hg.py	Sat Jan 09 22:58:10 2016 -0800
@@ -508,8 +508,16 @@
             return None, None
 
     def _changedfiles(self, ctx1, ctx2):
-        m, a, r = ctx1.status(ctx2)[:3]
-        return (m + a, r)
+        ma, r = [], []
+        maappend = ma.append
+        rappend = r.append
+        d = ctx1.manifest().diff(ctx2.manifest())
+        for f, ((node1, flag1), (node2, flag2)) in d.iteritems():
+            if node2 is None:
+                rappend(f)
+            else:
+                maappend(f)
+        return ma, r
 
     def getchanges(self, rev, full):
         ctx = self._changectx(rev)
@@ -529,8 +537,10 @@
         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)
+            d = parents[1].manifest().diff(ctx.manifest(), clean=True)
+            for f, value in d.iteritems():
+                if value is None:
+                    cleanp2.add(f)
         changes = [(f, rev) for f in files if f not in self.ignored]
         changes.sort()
         return changes, copies, cleanp2