comparison hgext/uncommit.py @ 43105:649d3ac37a12

py3: define and use pycompat.iteritems() for hgext/ .iteritems() -> .items() is the last source transform being performed. But it is also the most widely used. This commit adds a pycompat.iteritems symbol and imports it in place of .iteritems() for usage in hgext/. I chose to stop at just hgext/ because the patch will be large and it is an easy boundary to stop at since we can disable source transformation on a per-package basis. There are places where the type does implement items() and we could call items() directly. However, this would require critical thought and I thought it would be easier to just blindly change the code. We know which call sites need to be audited in the future because they have "pycompat.iteritems." With this change, we no longer perform source transformation on hgext! Differential Revision: https://phab.mercurial-scm.org/D7014
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Oct 2019 19:25:18 -0400
parents 687b865b95ad
children 8ff1ecfadcd1
comparison
equal deleted inserted replaced
43104:74802979dd9d 43105:649d3ac37a12
76 return ctx.p1().node() 76 return ctx.p1().node()
77 77
78 files = initialfiles - exclude 78 files = initialfiles - exclude
79 # Filter copies 79 # Filter copies
80 copied = copiesmod.pathcopies(base, ctx) 80 copied = copiesmod.pathcopies(base, ctx)
81 copied = dict((dst, src) for dst, src in copied.iteritems() if dst in files) 81 copied = dict(
82 (dst, src) for dst, src in pycompat.iteritems(copied) if dst in files
83 )
82 84
83 def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()): 85 def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()):
84 if path not in contentctx: 86 if path not in contentctx:
85 return None 87 return None
86 fctx = contentctx[path] 88 fctx = contentctx[path]