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.
| pulkit | 
| hg-reviewers | 
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.
| Lint Skipped | 
| Unit Tests Skipped | 
| Path | Packages | |||
|---|---|---|---|---|
| M | contrib/python3-whitelist (2 lines) | |||
| M | hgext/absorb.py (6 lines) | 
| Commit | Parents | Author | Summary | Date | 
|---|---|---|---|---|
| Augie Fackler | Aug 9 2018, 12:06 PM | 
| test-abort-checkin.t | test-abort-checkin.t | ||||
| test-absorb-phase.t | |||||
| test-absorb-strip.t | |||||
| test-add.t | test-add.t | ||||
| test-addremove-similar.t | test-addremove-similar.t | ||||
| test-addremove.t | test-addremove.t | ||||
| test-alias.t | test-alias.t | ||||
| test-amend-subrepo.t | test-amend-subrepo.t | ||||
| test-amend.t | test-amend.t | ||||
| test-ancestor.py | test-ancestor.py | ||||
| test-annotate.py | test-annotate.py | ||||
| # parents must contain 2 items: (node1, node2) | # parents must contain 2 items: (node1, node2) | ||||
| if parents is None: | if parents is None: | ||||
| parents = ctx.repo().changelog.parents(ctx.node()) | parents = ctx.repo().changelog.parents(ctx.node()) | ||||
| if extra is None: | if extra is None: | ||||
| extra = ctx.extra() | extra = ctx.extra() | ||||
| date = ctx.date() | date = ctx.date() | ||||
| desc = ctx.description() | desc = ctx.description() | ||||
| user = ctx.user() | user = ctx.user() | ||||
| files = set(ctx.files()).union(memworkingcopy.iterkeys()) | files = set(ctx.files()).union(memworkingcopy) | ||||
| store = overlaystore(ctx, memworkingcopy) | store = overlaystore(ctx, memworkingcopy) | ||||
| return context.memctx( | return context.memctx( | ||||
| repo=ctx.repo(), parents=parents, text=desc, | repo=ctx.repo(), parents=parents, text=desc, | ||||
| files=files, filectxfn=store, user=user, date=date, | files=files, filectxfn=store, user=user, date=date, | ||||
| branch=None, extra=extra) | branch=None, extra=extra) | ||||
| class filefixupstate(object): | class filefixupstate(object): | ||||
| """state needed to apply fixups to a single file | """state needed to apply fixups to a single file | ||||
| fctxs[0] will be considered as "immutable" and will not be changed. | fctxs[0] will be considered as "immutable" and will not be changed. | ||||
| """ | """ | ||||
| self.fctxs = fctxs | self.fctxs = fctxs | ||||
| self.ui = ui or nullui() | self.ui = ui or nullui() | ||||
| self.opts = opts or {} | self.opts = opts or {} | ||||
| # following fields are built from fctxs. they exist for perf reason | # following fields are built from fctxs. they exist for perf reason | ||||
| self.contents = [f.data() for f in fctxs] | 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() | self.linelog = self._buildlinelog() | ||||
| if self.ui.debugflag: | if self.ui.debugflag: | ||||
| assert self._checkoutlinelog() == self.contents | assert self._checkoutlinelog() == self.contents | ||||
| # following fields will be filled later | # following fields will be filled later | ||||
| self.chunkstats = [0, 0] # [adopted, total : int] | self.chunkstats = [0, 0] # [adopted, total : int] | ||||
| self.targetlines = [] # [str] | self.targetlines = [] # [str] | ||||
| self.fixups = [] # [(linelog rev, a1, a2, b1, b2)] | self.fixups = [] # [(linelog rev, a1, a2, b1, b2)] | ||||
| memworkingcopy overrides), return True. otherwise return False. | memworkingcopy overrides), return True. otherwise return False. | ||||
| """ | """ | ||||
| if not pctx: | if not pctx: | ||||
| parents = ctx.parents() | parents = ctx.parents() | ||||
| if len(parents) != 1: | if len(parents) != 1: | ||||
| return False | return False | ||||
| pctx = parents[0] | pctx = parents[0] | ||||
| # ctx changes more files (not a subset of memworkingcopy) | # 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 | return False | ||||
| for path, content in memworkingcopy.iteritems(): | for path, content in memworkingcopy.iteritems(): | ||||
| if path not in pctx or path not in ctx: | if path not in pctx or path not in ctx: | ||||
| return False | return False | ||||
| fctx = ctx[path] | fctx = ctx[path] | ||||
| pfctx = pctx[path] | pfctx = pctx[path] | ||||
| if pfctx.flags() != fctx.flags(): | if pfctx.flags() != fctx.flags(): | ||||
| return False | return False | ||||