absorb: port partway to Python 3
authorAugie Fackler <augie@google.com>
Thu, 09 Aug 2018 12:06:31 -0400
changeset 38987 9204445ad54c
parent 38986 ac0a87160012
child 38988 1aab0007a7c0
absorb: port partway to Python 3 Use pycompat.maplist() in the one place that matters and use the default iterator of a dict instead of iterkeys(). Two new tests pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D4174
contrib/python3-whitelist
hgext/absorb.py
--- a/contrib/python3-whitelist	Sat Aug 04 21:31:46 2018 -0400
+++ b/contrib/python3-whitelist	Thu Aug 09 12:06:31 2018 -0400
@@ -1,4 +1,6 @@
 test-abort-checkin.t
+test-absorb-phase.t
+test-absorb-strip.t
 test-add.t
 test-addremove-similar.t
 test-addremove.t
--- a/hgext/absorb.py	Sat Aug 04 21:31:46 2018 -0400
+++ b/hgext/absorb.py	Thu Aug 09 12:06:31 2018 -0400
@@ -245,7 +245,7 @@
     date = ctx.date()
     desc = ctx.description()
     user = ctx.user()
-    files = set(ctx.files()).union(memworkingcopy.iterkeys())
+    files = set(ctx.files()).union(memworkingcopy)
     store = overlaystore(ctx, memworkingcopy)
     return context.memctx(
         repo=ctx.repo(), parents=parents, text=desc,
@@ -286,7 +286,7 @@
 
         # following fields are built from fctxs. they exist for perf reason
         self.contents = [f.data() for f in fctxs]
-        self.contentlines = map(mdiff.splitnewlines, self.contents)
+        self.contentlines = pycompat.maplist(mdiff.splitnewlines, self.contents)
         self.linelog = self._buildlinelog()
         if self.ui.debugflag:
             assert self._checkoutlinelog() == self.contents
@@ -805,7 +805,7 @@
                 return False
             pctx = parents[0]
         # ctx changes more files (not a subset of memworkingcopy)
-        if not set(ctx.files()).issubset(set(memworkingcopy.iterkeys())):
+        if not set(ctx.files()).issubset(set(memworkingcopy)):
             return False
         for path, content in memworkingcopy.iteritems():
             if path not in pctx or path not in ctx: