diff --git a/hgext/absorb.py b/hgext/absorb.py --- a/hgext/absorb.py +++ b/hgext/absorb.py @@ -733,7 +733,7 @@ def apply(self): """apply fixups to individual filefixupstates""" - for path, state in pycompat.iteritems(self.fixupmap): + for path, state in self.fixupmap.items(): if self.ui.debugflag: self.ui.write(_(b'applying fixups to %s\n') % path) state.apply() @@ -741,10 +741,7 @@ @property def chunkstats(self): """-> {path: chunkstats}. collect chunkstats from filefixupstates""" - return { - path: state.chunkstats - for path, state in pycompat.iteritems(self.fixupmap) - } + return {path: state.chunkstats for path, state in self.fixupmap.items()} def commit(self): """commit changes. update self.finalnode, self.replacemap""" @@ -762,7 +759,7 @@ chunkstats = self.chunkstats if ui.verbose: # chunkstats for each file - for path, stat in pycompat.iteritems(chunkstats): + for path, stat in chunkstats.items(): if stat[0]: ui.write( _(b'%s: %d of %d chunk(s) applied\n') @@ -845,7 +842,7 @@ repo = self.repo needupdate = [ (name, self.replacemap[hsh]) - for name, hsh in pycompat.iteritems(repo._bookmarks) + for name, hsh in repo._bookmarks.items() if hsh in self.replacemap ] changes = [] @@ -908,7 +905,7 @@ # ctx changes more files (not a subset of memworkingcopy) if not set(ctx.files()).issubset(set(memworkingcopy)): return False - for path, content in pycompat.iteritems(memworkingcopy): + for path, content in memworkingcopy.items(): if path not in pctx or path not in ctx: return False fctx = ctx[path] @@ -951,7 +948,7 @@ def _cleanupoldcommits(self): replacements = { k: ([v] if v is not None else []) - for k, v in pycompat.iteritems(self.replacemap) + for k, v in self.replacemap.items() } if replacements: scmutil.cleanupnodes( @@ -1001,7 +998,7 @@ if not path or not info: continue patchmap[path].append(info) - for path, patches in pycompat.iteritems(patchmap): + for path, patches in patchmap.items(): if path not in ctx or not patches: continue patches.sort(reverse=True) diff --git a/hgext/convert/bzr.py b/hgext/convert/bzr.py --- a/hgext/convert/bzr.py +++ b/hgext/convert/bzr.py @@ -15,7 +15,6 @@ from mercurial import ( demandimport, error, - pycompat, util, ) from . import common @@ -209,7 +208,7 @@ if not branch.supports_tags(): return {} tagdict = branch.tags.get_tag_dict() - for name, rev in pycompat.iteritems(tagdict): + for name, rev in tagdict.items(): bytetags[self.recode(name)] = rev return bytetags diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -417,7 +417,7 @@ def _cmdline(self, cmd, *args, **kwargs): kwargs = pycompat.byteskwargs(kwargs) cmdline = [self.command, cmd] + list(args) - for k, v in pycompat.iteritems(kwargs): + for k, v in kwargs.items(): if len(k) == 1: cmdline.append(b'-' + k) else: diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -584,9 +584,7 @@ # write another hash correspondence to override the # previous one so we don't end up with extra tag heads tagsparents = [ - e - for e in pycompat.iteritems(self.map) - if e[1] == tagsparent + e for e in self.map.items() if e[1] == tagsparent ] if tagsparents: self.map[tagsparents[0][0]] = nrev diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -466,7 +466,7 @@ # find the branches starting from this revision branchpoints = set() - for branch, revision in pycompat.iteritems(branchmap): + for branch, revision in branchmap.items(): revparts = tuple([int(i) for i in revision.split(b'.')]) if len(revparts) < 2: # bad tags continue diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -125,7 +125,7 @@ repo belong to the source repo and what parts don't.""" if self.targetprefixes is None: self.targetprefixes = set() - for before, after in pycompat.iteritems(self.rename): + for before, after in self.rename.items(): self.targetprefixes.add(after) # If "." is a target, then all target files are considered from the diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -138,7 +138,7 @@ if missings: self.after() - for pbranch, heads in sorted(pycompat.iteritems(missings)): + for pbranch, heads in sorted(missings.items()): pbranchpath = os.path.join(self.path, pbranch) prepo = hg.peer(self.ui, {}, pbranchpath) self.ui.note( @@ -595,7 +595,7 @@ maappend = ma.append rappend = r.append d = ctx1.manifest().diff(ctx2.manifest()) - for f, ((node1, flag1), (node2, flag2)) in pycompat.iteritems(d): + for f, ((node1, flag1), (node2, flag2)) in d.items(): if node2 is None: rappend(f) else: @@ -621,7 +621,7 @@ cleanp2 = set() if len(parents) == 2: d = parents[1].manifest().diff(ctx.manifest(), clean=True) - for f, value in pycompat.iteritems(d): + for f, value in d.items(): if value is None: cleanp2.add(f) changes = [(f, rev) for f in files if f not in self.ignored] diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -102,7 +102,7 @@ # Prepare the command in automate stdio format kwargs = pycompat.byteskwargs(kwargs) command = [] - for k, v in pycompat.iteritems(kwargs): + for k, v in kwargs.items(): command.append(b"%d:%s" % (len(k), k)) if v: command.append(b"%d:%s" % (len(v), v)) diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -202,7 +202,7 @@ def receiver(orig_paths, revnum, author, date, message, pool): paths = {} if orig_paths is not None: - for k, v in pycompat.iteritems(orig_paths): + for k, v in orig_paths.items(): paths[k] = changedpath(v) pickle.dump((paths, revnum, author, date, message), fp, protocol) @@ -297,7 +297,7 @@ def receiver(orig_paths, revnum, author, date, message, pool): paths = {} if orig_paths is not None: - for k, v in pycompat.iteritems(orig_paths): + for k, v in orig_paths.items(): paths[k] = changedpath(v) self.append((paths, revnum, author, date, message)) @@ -729,7 +729,7 @@ ) files = [ n - for n, e in pycompat.iteritems(entries) + for n, e in entries.items() if e.kind == svn.core.svn_node_file ] self.removed = set() @@ -819,7 +819,7 @@ origpaths = [] copies = [ (e.copyfrom_path, e.copyfrom_rev, p) - for p, e in pycompat.iteritems(origpaths) + for p, e in origpaths.items() if e.copyfrom_path ] # Apply moves/copies from more specific to general @@ -850,7 +850,7 @@ # be represented in mercurial. addeds = { p: e.copyfrom_path - for p, e in pycompat.iteritems(origpaths) + for p, e in origpaths.items() if e.action == b'A' and e.copyfrom_path } badroots = set() @@ -1139,7 +1139,7 @@ parents = [] # check whether this revision is the start of a branch or part # of a branch renaming - orig_paths = sorted(pycompat.iteritems(orig_paths)) + orig_paths = sorted(orig_paths.items()) root_paths = [ (p, e) for p, e in orig_paths if self.module.startswith(p) ] @@ -1301,7 +1301,7 @@ path += b'/' return ( (path + p) - for p, e in pycompat.iteritems(entries) + for p, e in entries.items() if e.kind == svn.core.svn_node_file ) diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -378,7 +378,7 @@ if not repo.local(): return - for name, fn in pycompat.iteritems(filters): + for name, fn in filters.items(): repo.adddatafilter(name, fn) ui.setconfig(b'patch', b'eol', b'auto', b'eol') diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py +++ b/hgext/fastannotate/context.py @@ -174,7 +174,7 @@ def __init__(self, **opts): opts = pycompat.byteskwargs(opts) - for k, v in pycompat.iteritems(self.defaults): + for k, v in self.defaults.items(): setattr(self, k, opts.get(k, v)) @util.propertycache @@ -583,7 +583,7 @@ # find an unresolved line and its linelog rev to annotate hsh = None try: - for (rev, _linenum), idxs in pycompat.iteritems(key2idxs): + for (rev, _linenum), idxs in key2idxs.items(): if revmap.rev2flag(rev) & revmapmod.sidebranchflag: continue hsh = annotateresult[idxs[0]][0] @@ -594,7 +594,7 @@ # the remaining key2idxs are not in main branch, resolving them # using the hard way... revlines = {} - for (rev, linenum), idxs in pycompat.iteritems(key2idxs): + for (rev, linenum), idxs in key2idxs.items(): if rev not in revlines: hsh = annotateresult[idxs[0]][0] if self.ui.debugflag: diff --git a/hgext/fastannotate/protocol.py b/hgext/fastannotate/protocol.py --- a/hgext/fastannotate/protocol.py +++ b/hgext/fastannotate/protocol.py @@ -14,7 +14,6 @@ error, extensions, hg, - pycompat, util, wireprotov1peer, wireprotov1server, @@ -189,7 +188,7 @@ for result in results: r = result.result() # TODO: pconvert these paths on the server? - r = {util.pconvert(p): v for p, v in pycompat.iteritems(r)} + r = {util.pconvert(p): v for p, v in r.items()} for path in sorted(r): # ignore malicious paths if not path.startswith(b'fastannotate/') or b'/../' in ( diff --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -377,9 +377,7 @@ Useful as a hook point for extending "hg fix" with output summarizing the effects of the command, though we choose not to output anything here. """ - replacements = { - prec: [succ] for prec, succ in pycompat.iteritems(replacements) - } + replacements = {prec: [succ] for prec, succ in replacements.items()} scmutil.cleanupnodes(repo, replacements, b'fix', fixphase=True) @@ -692,7 +690,7 @@ """ metadata = {} newdata = fixctx[path].data() - for fixername, fixer in pycompat.iteritems(fixers): + for fixername, fixer in fixers.items(): if fixer.affects(opts, fixctx, path): ranges = lineranges( opts, path, basepaths, basectxs, fixctx, newdata @@ -770,7 +768,7 @@ Directly updates the dirstate for the affected files. """ - for path, data in pycompat.iteritems(filedata): + for path, data in filedata.items(): fctx = ctx[path] fctx.write(data, fctx.flags()) diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -501,15 +501,11 @@ visit.update(f for f in copymap if f not in results and matchfn(f)) else: if matchalways: - visit.update( - f for f, st in pycompat.iteritems(dmap) if f not in results - ) + visit.update(f for f, st in dmap.items() if f not in results) visit.update(f for f in copymap if f not in results) else: visit.update( - f - for f, st in pycompat.iteritems(dmap) - if f not in results and matchfn(f) + f for f, st in dmap.items() if f not in results and matchfn(f) ) visit.update(f for f in copymap if f not in results and matchfn(f)) diff --git a/hgext/githelp.py b/hgext/githelp.py --- a/hgext/githelp.py +++ b/hgext/githelp.py @@ -115,7 +115,7 @@ opts = dict( [ (k, convert(v)) if isinstance(v, bytes) else (k, v) - for k, v in pycompat.iteritems(opts) + for k, v in opts.items() ] ) @@ -131,7 +131,7 @@ def __bytes__(self): cmd = b"hg " + self.name if self.opts: - for k, values in sorted(pycompat.iteritems(self.opts)): + for k, values in sorted(self.opts.items()): for v in values: if v: if isinstance(v, int): diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -376,9 +376,7 @@ """start interactive history viewer""" opts = pycompat.byteskwargs(opts) os.chdir(repo.root) - optstr = b' '.join( - [b'--%s %s' % (k, v) for k, v in pycompat.iteritems(opts) if v] - ) + optstr = b' '.join([b'--%s %s' % (k, v) for k, v in opts.items() if v]) if repo.filtername is None: optstr += b'--hidden' diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -2101,7 +2101,7 @@ mapping, tmpnodes, created, ntm = processreplacement(state) if mapping: - for prec, succs in pycompat.iteritems(mapping): + for prec, succs in mapping.items(): if not succs: ui.debug(b'histedit: %s is dropped\n' % short(prec)) else: @@ -2139,7 +2139,7 @@ nodechanges = fd( { hf(oldn): fl([hf(n) for n in newn], name=b'node') - for oldn, newn in pycompat.iteritems(mapping) + for oldn, newn in mapping.items() }, key=b"oldnode", value=b"newnodes", @@ -2387,7 +2387,7 @@ tsum = summary[len(fword) + 1 :].lstrip() # safe but slow: reverse iterate over the actions so we # don't clash on two commits having the same summary - for na, l in reversed(list(pycompat.iteritems(newact))): + for na, l in reversed(list(newact.items())): actx = repo[na.node] asum = _getsummary(actx) if asum == tsum: @@ -2400,7 +2400,7 @@ # copy over and flatten the new list actions = [] - for na, l in pycompat.iteritems(newact): + for na, l in newact.items(): actions.append(na) actions += l diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -419,7 +419,7 @@ if pattern.endswith(b'*'): pattern = b're:^' + pattern[:-1] + b'.*' kind, pat, matcher = stringutil.stringmatcher(pattern) - for bookmark, node in pycompat.iteritems(bookmarks): + for bookmark, node in bookmarks.items(): if matcher(bookmark): results[bookmark] = node return results @@ -542,7 +542,7 @@ if part.type == b'changegroup': haschangegroup = True newpart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): newpart.addparam(key, value) parts.append(newpart) @@ -794,7 +794,7 @@ # saveremotenames expects 20 byte binary nodes for branches branches[rname].append(bin(hexnode)) - for bookmark, hexnode in pycompat.iteritems(newbookmarks): + for bookmark, hexnode in newbookmarks.items(): bookmarks[bookmark] = hexnode remotenamesext.saveremotenames(repo, remotepath, branches, bookmarks) @@ -804,7 +804,7 @@ return with repo.wlock(), repo.lock(), repo.transaction(b'bookmark') as tr: changes = [] - for scratchbook, node in pycompat.iteritems(bookmarks): + for scratchbook, node in bookmarks.items(): changectx = repo[node] changes.append((scratchbook, changectx.node())) repo._bookmarks.applychanges(repo, tr, changes) @@ -1045,7 +1045,7 @@ bundle2._processpart(op, part) else: bundlepart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): bundlepart.addparam(key, value) # Certain parts require a response @@ -1137,7 +1137,7 @@ # differs from previous behavior, we need to put it behind a # config flag for incremental rollout. bundlepart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): bundlepart.addparam(key, value) # Certain parts require a response @@ -1323,9 +1323,7 @@ b'new': newnode, b'old': oldnode, } - op.reply.newpart( - b'pushkey', mandatoryparams=pycompat.iteritems(params) - ) + op.reply.newpart(b'pushkey', mandatoryparams=params.items()) def bundle2pushkey(orig, op, part): diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -12,7 +12,6 @@ changegroup, error, extensions, - pycompat, revsetlang, util, ) @@ -67,7 +66,7 @@ parts.append( bundle2.bundlepart( scratchbranchparttype.upper(), - advisoryparams=pycompat.iteritems(params), + advisoryparams=params.items(), data=cg, ) ) diff --git a/hgext/infinitepush/sqlindexapi.py b/hgext/infinitepush/sqlindexapi.py --- a/hgext/infinitepush/sqlindexapi.py +++ b/hgext/infinitepush/sqlindexapi.py @@ -13,8 +13,6 @@ import warnings import mysql.connector -from mercurial import pycompat - from . import indexapi @@ -179,7 +177,7 @@ self.sqlconnect() args = [] values = [] - for bookmark, node in pycompat.iteritems(bookmarks): + for bookmark, node in bookmarks.items(): args.append(b'(%s, %s, %s)') values.extend((bookmark, node, self.reponame)) args = b','.join(args) diff --git a/hgext/journal.py b/hgext/journal.py --- a/hgext/journal.py +++ b/hgext/journal.py @@ -128,7 +128,7 @@ repo = store._repo if util.safehasattr(repo, 'journal'): oldmarks = bookmarks.bmstore(repo) - for mark, value in pycompat.iteritems(store): + for mark, value in store.items(): oldvalue = oldmarks.get(mark, repo.nullid) if value != oldvalue: repo.journal.record(bookmarktype, mark, oldvalue, value) diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -513,7 +513,7 @@ kwmaps = _defaultkwmaps(ui) if uikwmaps: ui.status(_(b'\tdisabling current template maps\n')) - for k, v in pycompat.iteritems(kwmaps): + for k, v in kwmaps.items(): ui.setconfig(b'keywordmaps', k, v, b'keyword') else: ui.status(_(b'\n\tconfiguration using current keyword template maps\n')) @@ -527,7 +527,7 @@ ui.writenoi18n(b'[extensions]\nkeyword =\n') demoitems(b'keyword', ui.configitems(b'keyword')) demoitems(b'keywordset', ui.configitems(b'keywordset')) - demoitems(b'keywordmaps', pycompat.iteritems(kwmaps)) + demoitems(b'keywordmaps', kwmaps.items()) keywords = b'$' + b'$\n$'.join(sorted(kwmaps.keys())) + b'$\n' repo.wvfs.write(fn, keywords) repo[None].add([fn]) diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -713,7 +713,7 @@ copies = orig(ctx1, ctx2, match=match) updated = {} - for k, v in pycompat.iteritems(copies): + for k, v in copies.items(): updated[lfutil.splitstandin(k) or k] = lfutil.splitstandin(v) or v return updated diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -62,7 +62,7 @@ def validate(self): """raise InvalidPointer on error. return self if there is no error""" requiredcount = 0 - for k, v in pycompat.iteritems(self): + for k, v in self.items(): if k in self._requiredre: if not self._requiredre[k].match(v): raise InvalidPointer( diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -24,7 +24,6 @@ exchange, exthelper, localrepo, - pycompat, revlog, scmutil, util, @@ -142,7 +141,7 @@ # translate hg filelog metadata to lfs metadata with "x-hg-" prefix if hgmeta is not None: - for k, v in pycompat.iteritems(hgmeta): + for k, v in hgmeta.items(): metadata[b'x-hg-%s' % k] = v rawtext = metadata.serialize() diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2024,7 +2024,7 @@ # we can't copy a file created by the patch itself if dst in copies: del copies[dst] - for src, dsts in pycompat.iteritems(copies): + for src, dsts in copies.items(): for dst in dsts: repo.dirstate.copy(src, dst) else: @@ -4287,7 +4287,7 @@ entry[1].extend(mqopt) def dotable(cmdtable): - for cmd, entry in pycompat.iteritems(cmdtable): + for cmd, entry in cmdtable.items(): cmd = cmdutil.parsealiases(cmd)[0] func = entry[0] if func.norepo: diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -2279,7 +2279,7 @@ drevmap = getdrevmap(repo, logcmdutil.revrange(repo, [revs])) specs = [] unknown = [] - for r, d in pycompat.iteritems(drevmap): + for r, d in drevmap.items(): if d is None: unknown.append(repo[r]) else: @@ -2364,7 +2364,7 @@ revs = repo.revs('sort(_underway(), topo)') drevmap = getdrevmap(repo, revs) unknownrevs, drevids, revsbydrevid = [], set(), {} - for rev, drevid in pycompat.iteritems(drevmap): + for rev, drevid in drevmap.items(): if drevid is not None: drevids.add(drevid) revsbydrevid.setdefault(drevid, set()).add(rev) diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -243,7 +243,7 @@ f.write(b'%d\n' % int(self.keepbranchesf)) f.write(b'%s\n' % (self.activebookmark or b'')) destmap = self.destmap - for d, v in pycompat.iteritems(self.state): + for d, v in self.state.items(): oldrev = repo[d].hex() if v >= 0: newrev = repo[v].hex() @@ -505,7 +505,7 @@ # commits. self.storestatus(tr) - cands = [k for k, v in pycompat.iteritems(self.state) if v == revtodo] + cands = [k for k, v in self.state.items() if v == revtodo] p = repo.ui.makeprogress( _(b"rebasing"), unit=_(b'changesets'), total=len(cands) ) @@ -1336,7 +1336,7 @@ # emulate the old behavior, showing "nothing to rebase" (a better # behavior may be abort with "cannot find branching point" error) bpbase.clear() - for bp, bs in pycompat.iteritems(bpbase): # calculate roots + for bp, bs in bpbase.items(): # calculate roots roots += list(repo.revs(b'children(%d) & ancestors(%ld)', bp, bs)) rebaseset = repo.revs(b'%ld::', roots) @@ -2103,7 +2103,7 @@ fl = fm.formatlist fd = fm.formatdict changes = {} - for oldns, newn in pycompat.iteritems(replacements): + for oldns, newn in replacements.items(): for oldn in oldns: changes[hf(oldn)] = fl([hf(n) for n in newn], name=b'node') nodechanges = fd(changes, key=b"oldnode", value=b"newnodes") diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -177,7 +177,7 @@ custom_sections = getcustomadmonitions(repo) if custom_sections: sections.update(custom_sections) - self._sections = list(pycompat.iteritems(sections)) + self._sections = list(sections.items()) else: self._sections = list(DEFAULT_SECTIONS) diff --git a/hgext/remotefilelog/basestore.py b/hgext/remotefilelog/basestore.py --- a/hgext/remotefilelog/basestore.py +++ b/hgext/remotefilelog/basestore.py @@ -146,7 +146,7 @@ filenamemap = self._resolvefilenames(existing.keys()) - for filename, sha in pycompat.iteritems(filenamemap): + for filename, sha in filenamemap.items(): yield (filename, existing[sha]) def _resolvefilenames(self, hashes): diff --git a/hgext/remotefilelog/datapack.py b/hgext/remotefilelog/datapack.py --- a/hgext/remotefilelog/datapack.py +++ b/hgext/remotefilelog/datapack.py @@ -453,7 +453,7 @@ def createindex(self, nodelocations, indexoffset): entries = sorted( - (n, db, o, s) for n, (db, o, s) in pycompat.iteritems(self.entries) + (n, db, o, s) for n, (db, o, s) in self.entries.items() ) rawindex = b'' diff --git a/hgext/remotefilelog/historypack.py b/hgext/remotefilelog/historypack.py --- a/hgext/remotefilelog/historypack.py +++ b/hgext/remotefilelog/historypack.py @@ -519,7 +519,7 @@ files = ( (hashutil.sha1(filename).digest(), filename, offset, size) - for filename, (offset, size) in pycompat.iteritems(self.files) + for filename, (offset, size) in self.files.items() ) files = sorted(files) @@ -555,7 +555,7 @@ ) nodeindexoffset += constants.FILENAMESIZE + len(filename) - for node, location in sorted(pycompat.iteritems(nodelocations)): + for node, location in sorted(nodelocations.items()): nodeindexentries.append( struct.pack(nodeindexformat, node, location) ) diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py +++ b/hgext/remotefilelog/remotefilelog.py @@ -15,7 +15,6 @@ ancestor, error, mdiff, - pycompat, revlog, ) from mercurial.utils import storageutil @@ -423,7 +422,7 @@ return self.repo.nullid revmap, parentfunc = self._buildrevgraph(a, b) - nodemap = {v: k for (k, v) in pycompat.iteritems(revmap)} + nodemap = {v: k for (k, v) in revmap.items()} ancs = ancestor.ancestors(parentfunc, revmap[a], revmap[b]) if ancs: @@ -438,7 +437,7 @@ return self.repo.nullid revmap, parentfunc = self._buildrevgraph(a, b) - nodemap = {v: k for (k, v) in pycompat.iteritems(revmap)} + nodemap = {v: k for (k, v) in revmap.items()} ancs = ancestor.commonancestorsheads(parentfunc, revmap[a], revmap[b]) return map(nodemap.__getitem__, ancs) @@ -454,7 +453,7 @@ parentsmap = collections.defaultdict(list) allparents = set() for mapping in (amap, bmap): - for node, pdata in pycompat.iteritems(mapping): + for node, pdata in mapping.items(): parents = parentsmap[node] p1, p2, linknode, copyfrom = pdata # Don't follow renames (copyfrom). diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py --- a/hgext/remotefilelog/remotefilelogserver.py +++ b/hgext/remotefilelog/remotefilelogserver.py @@ -21,7 +21,6 @@ error, extensions, match, - pycompat, scmutil, store, streamclone, @@ -416,7 +415,7 @@ cachepath = repo.vfs.join(b"remotefilelogcache") for head in heads: mf = repo[head].manifest() - for filename, filenode in pycompat.iteritems(mf): + for filename, filenode in mf.items(): filecachepath = os.path.join(cachepath, filename, hex(filenode)) neededfiles.add(filecachepath) diff --git a/hgext/remotefilelog/repack.py b/hgext/remotefilelog/repack.py --- a/hgext/remotefilelog/repack.py +++ b/hgext/remotefilelog/repack.py @@ -487,12 +487,12 @@ if type(m) is dict: # m is a result of diff of two manifests and is a dictionary that # maps filename to ((newnode, newflag), (oldnode, oldflag)) tuple - for filename, diff in pycompat.iteritems(m): + for filename, diff in m.items(): if diff[0][0] is not None: keepkeys.add(keyfn(filename, diff[0][0])) else: # m is a manifest object - for filename, filenode in pycompat.iteritems(m): + for filename, filenode in m.items(): keepkeys.add(keyfn(filename, filenode)) return keepkeys @@ -602,7 +602,7 @@ repackprogress = ui.makeprogress( _(b"repacking data"), unit=self.unit, total=len(byfile) ) - for filename, entries in sorted(pycompat.iteritems(byfile)): + for filename, entries in sorted(byfile.items()): repackprogress.update(count) ancestors = {} @@ -756,7 +756,7 @@ progress = ui.makeprogress( _(b"repacking history"), unit=self.unit, total=len(byfile) ) - for filename, entries in sorted(pycompat.iteritems(byfile)): + for filename, entries in sorted(byfile.items()): ancestors = {} nodes = list(node for node in entries) diff --git a/hgext/remotefilelog/shallowrepo.py b/hgext/remotefilelog/shallowrepo.py --- a/hgext/remotefilelog/shallowrepo.py +++ b/hgext/remotefilelog/shallowrepo.py @@ -14,7 +14,6 @@ error, localrepo, match, - pycompat, scmutil, sparse, util, @@ -268,7 +267,7 @@ mfrevlog = mfl.getstorage(b'') if base is not None: mfdict = mfl[repo[base].manifestnode()].read() - skip = set(pycompat.iteritems(mfdict)) + skip = set(mfdict.items()) else: skip = set() @@ -298,7 +297,7 @@ else: mfdict = mfl[mfnode].read() - diff = pycompat.iteritems(mfdict) + diff = mfdict.items() if pats: diff = (pf for pf in diff if m(pf[0])) if sparsematch: diff --git a/hgext/remotefilelog/shallowutil.py b/hgext/remotefilelog/shallowutil.py --- a/hgext/remotefilelog/shallowutil.py +++ b/hgext/remotefilelog/shallowutil.py @@ -102,7 +102,7 @@ """ result = collections.defaultdict(lambda: 0) for dict in dicts: - for k, v in pycompat.iteritems(dict): + for k, v in dict.items(): result[k] += v return result @@ -110,7 +110,7 @@ def prefixkeys(dict, prefix): """Returns ``dict`` with ``prefix`` prepended to all its keys.""" result = {} - for k, v in pycompat.iteritems(dict): + for k, v in dict.items(): result[prefix + k] = v return result @@ -208,7 +208,7 @@ integers. """ metadict = _parsepackmeta(metabuf) - for k, v in pycompat.iteritems(metadict): + for k, v in metadict.items(): if k in _metaitemtypes and int in _metaitemtypes[k]: metadict[k] = bin2int(v) return metadict diff --git a/hgext/remotenames.py b/hgext/remotenames.py --- a/hgext/remotenames.py +++ b/hgext/remotenames.py @@ -170,7 +170,7 @@ if not self.loaded: self._load() - for k, vtup in pycompat.iteritems(self.potentialentries): + for k, vtup in self.potentialentries.items(): yield (k, [bin(vtup[0])]) items = iteritems @@ -207,7 +207,7 @@ if not self._nodetobmarks: bmarktonodes = self.bmarktonodes() self._nodetobmarks = {} - for name, node in pycompat.iteritems(bmarktonodes): + for name, node in bmarktonodes.items(): self._nodetobmarks.setdefault(node[0], []).append(name) return self._nodetobmarks @@ -218,7 +218,7 @@ if not self._nodetobranch: branchtonodes = self.branchtonodes() self._nodetobranch = {} - for name, nodes in pycompat.iteritems(branchtonodes): + for name, nodes in branchtonodes.items(): for node in nodes: self._nodetobranch.setdefault(node, []).append(name) return self._nodetobranch @@ -228,7 +228,7 @@ marktonodes = self.bmarktonodes() self._hoisttonodes = {} hoist += b'/' - for name, node in pycompat.iteritems(marktonodes): + for name, node in marktonodes.items(): if name.startswith(hoist): name = name[len(hoist) :] self._hoisttonodes[name] = node @@ -239,7 +239,7 @@ marktonodes = self.bmarktonodes() self._nodetohoists = {} hoist += b'/' - for name, node in pycompat.iteritems(marktonodes): + for name, node in marktonodes.items(): if name.startswith(hoist): name = name[len(hoist) :] self._nodetohoists.setdefault(node[0], []).append(name) diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -80,9 +80,7 @@ files = initialfiles - exclude # Filter copies copied = copiesmod.pathcopies(base, ctx) - copied = { - dst: src for dst, src in pycompat.iteritems(copied) if dst in files - } + copied = {dst: src for dst, src in copied.items() if dst in files} def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()): if path not in contentctx: diff --git a/hgext/win32text.py b/hgext/win32text.py --- a/hgext/win32text.py +++ b/hgext/win32text.py @@ -212,7 +212,7 @@ def reposetup(ui, repo): if not repo.local(): return - for name, fn in pycompat.iteritems(_filters): + for name, fn in _filters.items(): repo.adddatafilter(name, fn) diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -75,7 +75,7 @@ def guesskind(dest): - for kind, extensions in pycompat.iteritems(exts): + for kind, extensions in exts.items(): if any(dest.endswith(ext) for ext in extensions): return kind return None diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -137,7 +137,7 @@ return iter(self._refmap) def iteritems(self): - return pycompat.iteritems(self._refmap) + return self._refmap.items() def items(self): return self._refmap.items() @@ -250,7 +250,7 @@ self._aclean = True def _write(self, fp): - for name, node in sorted(pycompat.iteritems(self._refmap)): + for name, node in sorted(self._refmap.items()): fp.write(b"%s %s\n" % (hex(node), encoding.fromlocal(name))) self._clean = True self._repo.invalidatevolatilesets() @@ -418,7 +418,7 @@ ) name = repo._activebookmark.split(b'@', 1)[0] heads = [] - for mark, n in pycompat.iteritems(repo._bookmarks): + for mark, n in repo._bookmarks.items(): if mark.split(b'@', 1)[0] == name: heads.append(n) return heads @@ -476,7 +476,7 @@ marks = getattr(repo, '_bookmarks', {}) hasnode = repo.changelog.hasnode - for k, v in pycompat.iteritems(marks): + for k, v in marks.items(): # don't expose local divergent bookmarks if hasnode(v) and not isdivergent(k): yield k, v @@ -687,7 +687,7 @@ remotemarks""" changed = [] localmarks = repo._bookmarks - for (b, id) in pycompat.iteritems(remotemarks): + for (b, id) in remotemarks.items(): if id != localmarks.get(b, None) and id in repo: changed.append((b, id, ui.debug, _(b"updating bookmark %s\n") % b)) for b in localmarks: @@ -1074,7 +1074,7 @@ hexfn = fm.hexfunc if len(bmarks) == 0 and fm.isplain(): ui.status(_(b"no bookmarks set\n")) - for bmark, (n, prefix, label) in sorted(pycompat.iteritems(bmarks)): + for bmark, (n, prefix, label) in sorted(bmarks.items()): fm.startitem() fm.context(repo=repo) if not ui.quiet: diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -270,7 +270,7 @@ return key in self._entries def iteritems(self): - for k, v in pycompat.iteritems(self._entries): + for k, v in self._entries.items(): self._verifybranch(k) yield k, v @@ -400,7 +400,7 @@ return heads def iterbranches(self): - for bn, heads in pycompat.iteritems(self): + for bn, heads in self.items(): yield (bn, heads) + self._branchtip(heads) def iterheads(self): @@ -434,7 +434,7 @@ cachekey.append(hex(self.filteredhash)) f.write(b" ".join(cachekey) + b'\n') nodecount = 0 - for label, nodes in sorted(pycompat.iteritems(self._entries)): + for label, nodes in sorted(self._entries.items()): label = encoding.fromlocal(label) for node in nodes: nodecount += 1 @@ -490,7 +490,7 @@ # Faster than using ctx.obsolete() obsrevs = obsolete.getrevs(repo, b'obsolete') - for branch, newheadrevs in pycompat.iteritems(newbranches): + for branch, newheadrevs in newbranches.items(): # For every branch, compute the new branchheads. # A branchhead is a revision such that no descendant is on # the same branch. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2239,7 +2239,7 @@ b'remote repository changed while pushing - please try again ' b'(%s is %s expected %s)' ) - for expectedphase, nodes in pycompat.iteritems(phasetonodes): + for expectedphase, nodes in phasetonodes.items(): for n in nodes: actualphase = phasecache.phase(unfi, cl.rev(n)) if actualphase != expectedphase: diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -424,7 +424,7 @@ mfnode = cl.changelogrevision(cset).manifest mfest = ml[mfnode].readdelta() # store file nodes we must see - for f, n in pycompat.iteritems(mfest): + for f, n in mfest.items(): needfiles.setdefault(f, set()).add(n) on_filelog_rev = None @@ -1193,7 +1193,7 @@ if self._ellipses and self._isshallow: mfdicts = [ (repo.manifestlog[n].read(), lr) - for (n, lr) in pycompat.iteritems(manifests) + for (n, lr) in manifests.items() ] manifests.clear() @@ -1966,7 +1966,7 @@ del needfiles[f] progress.complete() - for f, needs in pycompat.iteritems(needfiles): + for f, needs in needfiles.items(): fl = repo.file(f) for n in needs: try: diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -134,7 +134,7 @@ ignored = set() envitems = [ (k, v) - for k, v in pycompat.iteritems(encoding.environ) + for k, v in encoding.environ.items() if _envre.match(k) and k not in ignored ] envhash = _hashlist(sorted(envitems)) @@ -320,7 +320,7 @@ def __call__(self, cmd, environ, cwd=None, type=b'system', cmdtable=None): args = [type, cmd, util.abspath(cwd or b'.')] - args.extend(b'%s=%s' % (k, v) for k, v in pycompat.iteritems(environ)) + args.extend(b'%s=%s' % (k, v) for k, v in environ.items()) data = b'\0'.join(args) self.out.write(struct.pack(b'>cI', self.channel, len(data))) self.out.write(data) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -626,7 +626,7 @@ # 5. finally restore backed-up files try: dirstate = repo.dirstate - for realname, tmpname in pycompat.iteritems(backups): + for realname, tmpname in backups.items(): ui.debug(b'restoring %r to %r\n' % (tmpname, realname)) if dirstate.get_entry(realname).maybe_clean: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2469,7 +2469,7 @@ ) def debugcommands(ui, cmd=b'', *args): """list all available commands and options""" - for cmd, vals in sorted(pycompat.iteritems(table)): + for cmd, vals in sorted(table.items()): cmd = cmd.split(b'|')[0] opts = b', '.join([i[1] for i in vals[1]]) ui.write(b'%s: %s\n' % (cmd, opts)) @@ -7089,7 +7089,7 @@ c = repo.dirstate.copies() copied, renamed = [], [] - for d, s in pycompat.iteritems(c): + for d, s in c.items(): if s in status.removed: status.removed.remove(s) renamed.append(d) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -123,7 +123,7 @@ deleted, unknown, ignored = s.deleted, s.unknown, s.ignored deletedset = set(deleted) d = mf1.diff(mf2, match=match, clean=listclean) - for fn, value in pycompat.iteritems(d): + for fn, value in d.items(): if fn in deletedset: continue if value is None: diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -17,7 +17,6 @@ match as matchmod, pathutil, policy, - pycompat, util, ) @@ -68,7 +67,7 @@ def _chain(prefix, suffix): """chain two sets of copies 'prefix' and 'suffix'""" result = prefix.copy() - for key, value in pycompat.iteritems(suffix): + for key, value in suffix.items(): result[key] = prefix.get(value, value) return result @@ -408,7 +407,7 @@ if childcopies: newcopies = copies.copy() - for dest, source in pycompat.iteritems(childcopies): + for dest, source in childcopies.items(): prev = copies.get(source) if prev is not None and prev[1] is not None: source = prev[1] @@ -623,7 +622,7 @@ newcopies = copies if childcopies: newcopies = copies.copy() - for dest, source in pycompat.iteritems(childcopies): + for dest, source in childcopies.items(): prev = copies.get(source) if prev is not None and prev[1] is not None: source = prev[1] @@ -721,7 +720,7 @@ # can still exist (e.g. hg cp a b; hg mv a c). In those cases we # arbitrarily pick one of the renames. r = {} - for k, v in sorted(pycompat.iteritems(copies)): + for k, v in sorted(copies.items()): if match and not match(v): continue # remove copies @@ -1080,7 +1079,7 @@ # examine each file copy for a potential directory move, which is # when all the files in a directory are moved to a new directory - for dst, src in pycompat.iteritems(fullcopy): + for dst, src in fullcopy.items(): dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst) if dsrc in invalid: # already seen to be uninteresting @@ -1103,7 +1102,7 @@ if not dirmove: return {}, {} - dirmove = {k + b"/": v + b"/" for k, v in pycompat.iteritems(dirmove)} + dirmove = {k + b"/": v + b"/" for k, v in dirmove.items()} for d in dirmove: repo.ui.debug( @@ -1186,7 +1185,7 @@ copies2 = {} cp = _forwardcopies(base, c2) - for dst, src in pycompat.iteritems(cp): + for dst, src in cp.items(): if src in m1: copies2[dst] = src @@ -1304,5 +1303,5 @@ for dest, __ in list(new_copies.items()): if dest in parent: del new_copies[dest] - for dst, src in pycompat.iteritems(new_copies): + for dst, src in new_copies.items(): wctx[dst].markcopied(src) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -492,7 +492,7 @@ b2caps = bundle2.bundle2caps(peer) if b2caps: ui.writenoi18n(b'Bundle2 capabilities:\n') - for key, values in sorted(pycompat.iteritems(b2caps)): + for key, values in sorted(b2caps.items()): ui.write(b' %s\n' % key) for v in values: ui.write(b' %s\n' % v) @@ -2388,7 +2388,7 @@ if f in ms: # If file is in mergestate, we have already processed it's extras continue - for k, v in pycompat.iteritems(d): + for k, v in d.items(): fm_extras.startitem() fm_extras.data(file=f) fm_extras.data(key=k) @@ -2405,7 +2405,7 @@ names = set() # since we previously only listed open branches, we will handle that # specially (after this for loop) - for name, ns in pycompat.iteritems(repo.names): + for name, ns in repo.names.items(): if name != b'branches': names.update(ns.listnames(repo)) names.update( @@ -2699,7 +2699,7 @@ fullpaths = opts['full'] files, dirs = set(), set() adddir, addfile = dirs.add, files.add - for f, st in pycompat.iteritems(dirstate): + for f, st in dirstate.items(): if f.startswith(spec) and st.state in acceptable: if fixpaths: f = f.replace(b'/', pycompat.ossep) @@ -4270,7 +4270,7 @@ for opt in cmdutil.remoteopts: del opts[opt[1]] args = {} - for k, v in pycompat.iteritems(opts): + for k, v in opts.items(): if v: args[k] = v args = pycompat.strkwargs(args) diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -342,7 +342,7 @@ return iter(sorted(self._map)) def items(self): - return pycompat.iteritems(self._map) + return self._map.items() iteritems = items @@ -770,9 +770,7 @@ def _writedirstate(self, tr, st): # notify callbacks about parents change if self._origpl is not None and self._origpl != self._pl: - for c, callback in sorted( - pycompat.iteritems(self._plchangecallbacks) - ): + for c, callback in sorted(self._plchangecallbacks.items()): callback(self, self._origpl, self._pl) self._origpl = None self._map.write(tr, st) @@ -935,7 +933,7 @@ if match.isexact() and self._checkcase: normed = {} - for f, st in pycompat.iteritems(results): + for f, st in results.items(): if st is None: continue @@ -948,7 +946,7 @@ paths.add(f) - for norm, paths in pycompat.iteritems(normed): + for norm, paths in normed.items(): if len(paths) > 1: for path in paths: folded = self._discoverpath( diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py +++ b/mercurial/dirstatemap.py @@ -12,7 +12,6 @@ error, pathutil, policy, - pycompat, txnutil, util, ) @@ -354,7 +353,7 @@ util.clearcachedproperty(self, b"dirfoldmap") def items(self): - return pycompat.iteritems(self._map) + return self._map.items() # forward for python2,3 compat iteritems = items @@ -378,7 +377,7 @@ self._dirtyparents = True copies = {} if fold_p2: - for f, s in pycompat.iteritems(self._map): + for f, s in self._map.items(): # Discard "merged" markers when moving away from a merge state if s.p2_info: source = self.copymap.pop(f, None) @@ -501,7 +500,7 @@ f = {} normcase = util.normcase - for name, s in pycompat.iteritems(self._map): + for name, s in self._map.items(): if not s.removed: f[normcase(name)] = name f[b'.'] = b'.' # prevents useless util.fspath() invocation diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -20,7 +20,6 @@ error, obsolete, phases, - pycompat, scmutil, setdiscovery, treediscovery, @@ -237,7 +236,7 @@ knownnode = cl.hasnode # do not use nodemap until it is filtered # A. register remote heads of branches which are in outgoing set - for branch, heads in pycompat.iteritems(remotemap): + for branch, heads in remotemap.items(): # don't add head info about branches which we don't have locally if branch not in branches: continue @@ -261,14 +260,14 @@ repo, ( (branch, heads[1]) - for branch, heads in pycompat.iteritems(headssum) + for branch, heads in headssum.items() if heads[0] is not None ), ) newmap.update(repo, (ctx.rev() for ctx in missingctx)) - for branch, newheads in pycompat.iteritems(newmap): + for branch, newheads in newmap.items(): headssum[branch][1][:] = newheads - for branch, items in pycompat.iteritems(headssum): + for branch, items in headssum.items(): for l in items: if l is not None: l.sort() @@ -280,7 +279,7 @@ futureheads = {torev(h) for h in outgoing.ancestorsof} futureheads |= {torev(h) for h in outgoing.commonheads} allfuturecommon = repo.changelog.ancestors(futureheads, inclusive=True) - for branch, heads in sorted(pycompat.iteritems(headssum)): + for branch, heads in sorted(headssum.items()): remoteheads, newheads, unsyncedheads, placeholder = heads result = _postprocessobsolete(pushop, allfuturecommon, newheads) headssum[branch] = ( @@ -379,9 +378,7 @@ headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) pushop.pushbranchmap = headssum newbranches = [ - branch - for branch, heads in pycompat.iteritems(headssum) - if heads[0] is None + branch for branch, heads in headssum.items() if heads[0] is None ] # 1. Check for new branches on the remote. if newbranches and not newbranch: # new branch requires --new-branch @@ -409,7 +406,7 @@ # If there are more heads after the push than before, a suitable # error message, depending on unsynced status, is displayed. errormsg = None - for branch, heads in sorted(pycompat.iteritems(headssum)): + for branch, heads in sorted(headssum.items()): remoteheads, newheads, unsyncedheads, discardedheads = heads # add unsynced data if remoteheads is None: diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -572,7 +572,7 @@ try: aliases, entry = cmdutil.findcmd(self.name, cmdtable) - for alias, e in pycompat.iteritems(cmdtable): + for alias, e in cmdtable.items(): if e is entry: self.cmd = alias break diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -805,7 +805,7 @@ bundler.newpart(b'check:heads', data=iter(pushop.remoteheads)) else: affected = set() - for branch, heads in pycompat.iteritems(pushop.pushbranchmap): + for branch, heads in pushop.pushbranchmap.items(): remoteheads, newheads, unsyncedheads, discardedheads = heads if remoteheads is not None: remote = set(remoteheads) @@ -1116,7 +1116,7 @@ part = bundler.newpart(b'pushvars') - for key, value in pycompat.iteritems(shellvars): + for key, value in shellvars.items(): part.addparam(key, value, mandatory=False) diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -73,7 +73,7 @@ try: mod = _extensions[name] except KeyError: - for k, v in pycompat.iteritems(_extensions): + for k, v in _extensions.items(): if k.endswith(b'.' + name) or k.endswith(b'/' + name): mod = v break @@ -170,7 +170,7 @@ def _validatecmdtable(ui, cmdtable): """Check if extension commands have required attributes""" - for c, e in pycompat.iteritems(cmdtable): + for c, e in cmdtable.items(): f = e[0] missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)] if not missing: @@ -578,7 +578,7 @@ ''' assert callable(wrapper) aliases, entry = cmdutil.findcmd(command, table) - for alias, e in pycompat.iteritems(table): + for alias, e in table.items(): if e is entry: key = alias break @@ -755,7 +755,7 @@ if name in exts or name in _order or name == b'__init__': continue exts[name] = path - for name, path in pycompat.iteritems(_disabledextensions): + for name, path in _disabledextensions.items(): # If no path was provided for a disabled extension (e.g. "color=!"), # don't replace the path we already found by the scan above. if path: @@ -817,7 +817,7 @@ return { name: gettext(desc) - for name, desc in pycompat.iteritems(__index__.docs) + for name, desc in __index__.docs.items() if name not in _order } except (ImportError, AttributeError): @@ -828,7 +828,7 @@ return {} exts = {} - for name, path in pycompat.iteritems(paths): + for name, path in paths.items(): doc = _disabledhelp(path) if doc and name != b'__index__': exts[name] = doc.splitlines()[0] @@ -917,7 +917,7 @@ ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict) if not ext: # otherwise, interrogate each extension until there's a match - for name, path in pycompat.iteritems(paths): + for name, path in paths.items(): ext = _finddisabledcmd(ui, cmd, name, path, strict=strict) if ext: break @@ -942,9 +942,7 @@ def notloaded(): '''return short names of extensions that failed to load''' - return [ - name for name, mod in pycompat.iteritems(_extensions) if mod is None - ] + return [name for name, mod in _extensions.items() if mod is None] def moduleversion(module): diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py --- a/mercurial/exthelper.py +++ b/mercurial/exthelper.py @@ -14,7 +14,6 @@ commands, error, extensions, - pycompat, registrar, ) @@ -114,7 +113,7 @@ self._extcommandwrappers.extend(other._extcommandwrappers) self._functionwrappers.extend(other._functionwrappers) self.cmdtable.update(other.cmdtable) - for section, items in pycompat.iteritems(other.configtable): + for section, items in other.configtable.items(): if section in self.configtable: self.configtable[section].update(items) else: diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -1199,7 +1199,7 @@ def loadinternalmerge(ui, extname, registrarobj): """Load internal merge tool from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): fullname = b':' + name internals[fullname] = func internals[b'internal:' + name] = func diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -613,7 +613,7 @@ def loadpredicate(ui, extname, registrarobj): """Load fileset predicates from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): symbols[name] = func diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -293,7 +293,7 @@ def _iteritems(data): '''iterate key-value pairs in stable order''' if isinstance(data, dict): - return sorted(pycompat.iteritems(data)) + return sorted(data.items()) return data diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -125,7 +125,7 @@ '''return a text listing of the given extensions''' rst = [] if exts: - for name, desc in sorted(pycompat.iteritems(exts)): + for name, desc in sorted(exts.items()): if not showdeprecated and any(w in desc for w in _exclkeywords): continue rst.append(b'%s:%s: %s\n' % (b' ' * indent, name, desc)) @@ -280,7 +280,7 @@ name = names[0] if not filtertopic(ui, name): results[b'topics'].append((names[0], header)) - for cmd, entry in pycompat.iteritems(commands.table): + for cmd, entry in commands.table.items(): if len(entry) == 3: summary = entry[2] else: @@ -664,7 +664,7 @@ h = {} # Command -> string showing synonyms syns = {} - for c, e in pycompat.iteritems(cmdtable): + for c, e in cmdtable.items(): fs = cmdutil.parsealiases(c) f = fs[0] syns[f] = fs diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -412,7 +412,7 @@ if cmd == b'archive': fn = req.qsparams[b'node'] - for type_, spec in pycompat.iteritems(webutil.archivespecs): + for type_, spec in webutil.archivespecs.items(): ext = spec[2] if fn.endswith(ext): req.qsparams[b'node'] = fn[: -len(ext)] diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -77,7 +77,7 @@ return vals[0] def asdictoflists(self): - return {k: list(v) for k, v in pycompat.iteritems(self._items)} + return {k: list(v) for k, v in self._items.items()} @attr.s(frozen=True) @@ -175,7 +175,7 @@ # This is what is documented to be used for os.environ on Unix. return pycompat.fsencode(s) - env = {tobytes(k): tobytes(v) for k, v in pycompat.iteritems(env)} + env = {tobytes(k): tobytes(v) for k, v in env.items()} # Some hosting solutions are emulating hgwebdir, and dispatching directly # to an hgweb instance using this environment variable. This was always @@ -309,7 +309,7 @@ # perform case normalization for us. We just rewrite underscore to dash # so keys match what likely went over the wire. headers = [] - for k, v in pycompat.iteritems(env): + for k, v in env.items(): if k.startswith(b'HTTP_'): headers.append((k[len(b'HTTP_') :].replace(b'_', b'-'), v)) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -563,7 +563,7 @@ l = len(path) abspath = b"/" + path - for full, n in pycompat.iteritems(mf): + for full, n in mf.items(): # the virtual path (working copy path) used for the full # (repository) path f = decodepath(full) @@ -1520,7 +1520,7 @@ early, other = [], [] primary = lambda s: s.partition(b'|')[0] - for c, e in pycompat.iteritems(commands.table): + for c, e in commands.table.items(): doc = _getdoc(e) if b'DEPRECATED' in doc or c.startswith(b'debug'): continue diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -56,7 +56,7 @@ allowed = ui.configlist(b'web', b'allow-archive', untrusted=True) archives = [] - for typ, spec in pycompat.iteritems(archivespecs): + for typ, spec in archivespecs.items(): if typ in allowed or ui.configbool( b'web', b'allow' + typ, untrusted=True ): @@ -863,7 +863,7 @@ def itermaps(self, context): separator = self._start - for key, value in sorted(pycompat.iteritems(self._vars)): + for key, value in sorted(self._vars.items()): yield { b'name': key, b'value': pycompat.bytestr(value), diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py --- a/mercurial/hgweb/wsgicgi.py +++ b/mercurial/hgweb/wsgicgi.py @@ -23,7 +23,7 @@ procutil.setbinary(procutil.stdin) procutil.setbinary(procutil.stdout) - environ = dict(pycompat.iteritems(os.environ)) # re-exports + environ = dict(os.environ.items()) # re-exports environ.setdefault('PATH_INFO', '') if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'): # IIS includes script_name in PATH_INFO diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -166,7 +166,7 @@ else: env[b'HGPLAIN'] = b'' - for k, v in pycompat.iteritems(args): + for k, v in args.items(): # transaction changes can accumulate MBs of data, so skip it # for external hooks if k == b'changes': diff --git a/mercurial/httpconnection.py b/mercurial/httpconnection.py --- a/mercurial/httpconnection.py +++ b/mercurial/httpconnection.py @@ -93,7 +93,7 @@ bestuser = None bestlen = 0 bestauth = None - for group, auth in pycompat.iteritems(groups): + for group, auth in groups.items(): if user and user != auth.get(b'username', user): # If a username was set in the URI, the entry username # must either match it or be unset diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2068,7 +2068,7 @@ else: tags = self._tagscache.tags rev = self.changelog.rev - for k, v in pycompat.iteritems(tags): + for k, v in tags.items(): try: # ignore tags to unknown nodes rev(v) @@ -2103,13 +2103,12 @@ # writing to the cache), but the rest of Mercurial wants them in # local encoding. tags = {} - for (name, (node, hist)) in pycompat.iteritems(alltags): + for (name, (node, hist)) in alltags.items(): if node != self.nullid: tags[encoding.tolocal(name)] = node tags[b'tip'] = self.changelog.tip() tagtypes = { - encoding.tolocal(name): value - for (name, value) in pycompat.iteritems(tagtypes) + encoding.tolocal(name): value for (name, value) in tagtypes.items() } return (tags, tagtypes) @@ -2138,7 +2137,7 @@ '''return the tags associated with a node''' if not self._tagscache.nodetagscache: nodetagscache = {} - for t, n in pycompat.iteritems(self._tagscache.tags): + for t, n in self._tagscache.tags.items(): nodetagscache.setdefault(n, []).append(t) for tags in pycompat.itervalues(nodetagscache): tags.sort() @@ -2256,7 +2255,7 @@ mf = matchmod.match(self.root, b'', [pat]) fn = None params = cmd - for name, filterfn in pycompat.iteritems(self._datafilters): + for name, filterfn in self._datafilters.items(): if cmd.startswith(name): fn = filterfn params = cmd[len(name) :].lstrip() diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -327,7 +327,7 @@ if branch != b'default': self.ui.write(columns[b'branch'] % branch, label=b'log.branch') - for nsname, ns in pycompat.iteritems(self.repo.names): + for nsname, ns in self.repo.names.items(): # branches has special logic already handled above, so here we just # skip it if nsname == b'branches': @@ -991,7 +991,7 @@ opts[b'_patslog'] = list(wopts.pats) expr = [] - for op, val in sorted(pycompat.iteritems(opts)): + for op, val in sorted(opts.items()): if not val: continue revop, listop = _opt2logrevset[op] diff --git a/mercurial/logexchange.py b/mercurial/logexchange.py --- a/mercurial/logexchange.py +++ b/mercurial/logexchange.py @@ -10,7 +10,6 @@ from .node import hex from . import ( - pycompat, util, vfs as vfsmod, ) @@ -77,7 +76,7 @@ if oldpath != remotepath: f.write(b'%s\0%s\0%s\n' % (node, oldpath, rname)) - for name, node in sorted(pycompat.iteritems(names)): + for name, node in sorted(names.items()): if nametype == b"branches": for n in node: f.write(b'%s\0%s\0%s\n' % (n, remotepath, name)) @@ -159,7 +158,7 @@ with remoterepo.commandexecutor() as e: branchmap = e.callcommand(b'branchmap', {}).result() - for branch, nodes in pycompat.iteritems(branchmap): + for branch, nodes in branchmap.items(): bmap[branch] = [] for node in nodes: if node in repo and not repo[node].obsolete(): diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py --- a/mercurial/lsprof.py +++ b/mercurial/lsprof.py @@ -2,7 +2,6 @@ import sys from .pycompat import getattr -from . import pycompat Profiler = _lsprof.Profiler @@ -124,7 +123,7 @@ try: mname = _fn2mod[code.co_filename] except KeyError: - for k, v in list(pycompat.iteritems(sys.modules)): + for k, v in list(sys.modules.items()): if v is None: continue if not isinstance(getattr(v, '__file__', None), str): diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -867,11 +867,11 @@ differs, load it in both """ toloadlazy = [] - for d, v1 in pycompat.iteritems(t1._lazydirs): + for d, v1 in t1._lazydirs.items(): v2 = t2._lazydirs.get(d) if not v2 or v2[0] != v1[0]: toloadlazy.append(d) - for d, v1 in pycompat.iteritems(t2._lazydirs): + for d, v1 in t2._lazydirs.items(): if d not in t1._lazydirs: toloadlazy.append(d) @@ -953,7 +953,7 @@ if p in self._files: yield self._subpath(p), n else: - for f, sn in pycompat.iteritems(n): + for f, sn in n.items(): yield f, sn iteritems = items @@ -1104,11 +1104,10 @@ def _copyfunc(s): self._load() s._lazydirs = { - d: (n, r, True) - for d, (n, r, c) in pycompat.iteritems(self._lazydirs) + d: (n, r, True) for d, (n, r, c) in self._lazydirs.items() } sdirs = s._dirs - for d, v in pycompat.iteritems(self._dirs): + for d, v in self._dirs.items(): sdirs[d] = v.copy() s._files = dict.copy(self._files) s._flags = dict.copy(self._flags) @@ -1136,7 +1135,7 @@ t1._load() t2._load() self._loaddifflazy(t1, t2) - for d, m1 in pycompat.iteritems(t1._dirs): + for d, m1 in t1._dirs.items(): if d in t2._dirs: m2 = t2._dirs[d] _filesnotin(m1, m2) @@ -1249,7 +1248,7 @@ ret._flags[fn] = self._flags[fn] visit = self._loadchildrensetlazy(visit) - for dir, subm in pycompat.iteritems(self._dirs): + for dir, subm in self._dirs.items(): if visit and dir[:-1] not in visit: continue m = subm._matches_inner(match) @@ -1294,15 +1293,15 @@ t2._load() self._loaddifflazy(t1, t2) - for d, m1 in pycompat.iteritems(t1._dirs): + for d, m1 in t1._dirs.items(): m2 = t2._dirs.get(d, emptytree) stack.append((m1, m2)) - for d, m2 in pycompat.iteritems(t2._dirs): + for d, m2 in t2._dirs.items(): if d not in t1._dirs: stack.append((emptytree, m2)) - for fn, n1 in pycompat.iteritems(t1._files): + for fn, n1 in t1._files.items(): fl1 = t1._flags.get(fn, b'') n2 = t2._files.get(fn, None) fl2 = t2._flags.get(fn, b'') @@ -1311,7 +1310,7 @@ elif clean: result[t1._subpath(fn)] = None - for fn, n2 in pycompat.iteritems(t2._files): + for fn, n2 in t2._files.items(): if fn not in t1._files: fl2 = t2._flags.get(fn, b'') result[t2._subpath(fn)] = ((None, b''), (n2, fl2)) @@ -1361,9 +1360,7 @@ """ self._load() flags = self.flags - lazydirs = [ - (d[:-1], v[0], b't') for d, v in pycompat.iteritems(self._lazydirs) - ] + lazydirs = [(d[:-1], v[0], b't') for d, v in self._lazydirs.items()] dirs = [(d[:-1], self._dirs[d]._node, b't') for d in self._dirs] files = [(f, self._files[f], flags(f)) for f in self._files] return _text(sorted(dirs + files + lazydirs)) @@ -1392,7 +1389,7 @@ visit = self._loadchildrensetlazy(visit) if visit == b'this' or visit == b'all': visit = None - for d, subm in pycompat.iteritems(self._dirs): + for d, subm in self._dirs.items(): if visit and d[:-1] not in visit: continue subp1 = getnode(m1, d) @@ -1415,7 +1412,7 @@ self._load() # OPT: use visitchildrenset to avoid loading everything. self._loadalllazy() - for d, subm in pycompat.iteritems(self._dirs): + for d, subm in self._dirs.items(): for subtree in subm.walksubtrees(matcher=matcher): yield subtree diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -1638,7 +1638,7 @@ continue linesyntax = syntax - for s, rels in pycompat.iteritems(syntaxes): + for s, rels in syntaxes.items(): if line.startswith(rels): linesyntax = rels line = line[len(rels) :] diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -643,10 +643,10 @@ def filemap(self, sort=False): if sorted: - for key, val in sorted(pycompat.iteritems(self._filemapping)): + for key, val in sorted(self._filemapping.items()): yield key, val else: - for key, val in pycompat.iteritems(self._filemapping): + for key, val in self._filemapping.items(): yield key, val def addcommitinfo(self, filename, key, value): @@ -671,15 +671,15 @@ """returns a dictionary of actions to be perfomed with action as key and a list of files and related arguments as values""" res = collections.defaultdict(list) - for a, d in pycompat.iteritems(self._actionmapping): - for f, (args, msg) in pycompat.iteritems(d): + for a, d in self._actionmapping.items(): + for f, (args, msg) in d.items(): res[a].append((f, args, msg)) return res def setactions(self, actions): self._filemapping = actions self._actionmapping = collections.defaultdict(dict) - for f, (act, data, msg) in pycompat.iteritems(self._filemapping): + for f, (act, data, msg) in self._filemapping.items(): self._actionmapping[act][f] = data, msg def hasconflicts(self): @@ -786,7 +786,7 @@ relevantfiles = set(ma.diff(m2).keys()) # For copied and moved files, we need to add the source file too. - for copykey, copyvalue in pycompat.iteritems(branch_copies1.copy): + for copykey, copyvalue in branch_copies1.copy.items(): if copyvalue in relevantfiles: relevantfiles.add(copykey) for movedirkey in branch_copies1.movewithdir: @@ -796,7 +796,7 @@ diff = m1.diff(m2, match=matcher) - for f, ((n1, fl1), (n2, fl2)) in pycompat.iteritems(diff): + for f, ((n1, fl1), (n2, fl2)) in diff.items(): if n1 and n2: # file exists on both local and remote side if f not in ma: # TODO: what if they're renamed from different sources? @@ -1511,7 +1511,7 @@ ms = wctx.mergestate(clean=True) ms.start(wctx.p1().node(), mctx.node(), labels) - for f, op in pycompat.iteritems(mresult.commitinfo): + for f, op in mresult.commitinfo.items(): # the other side of filenode was choosen while merging, store this in # mergestate so that it can be reused on commit ms.addcommitinfo(f, op) @@ -2072,7 +2072,7 @@ _checkcollision(repo, wc.manifest(), mresult) # divergent renames - for f, fl in sorted(pycompat.iteritems(mresult.diverge)): + for f, fl in sorted(mresult.diverge.items()): repo.ui.warn( _( b"note: possible conflict - %s was renamed " @@ -2084,7 +2084,7 @@ repo.ui.warn(b" %s\n" % nf) # rename and delete - for f, fl in sorted(pycompat.iteritems(mresult.renamedelete)): + for f, fl in sorted(mresult.renamedelete.items()): repo.ui.warn( _( b"note: possible conflict - %s was deleted " @@ -2124,7 +2124,7 @@ if updatedirstate: if extraactions: - for k, acts in pycompat.iteritems(extraactions): + for k, acts in extraactions.items(): for a in acts: mresult.addfile(a[0], k, *a[1:]) if k == mergestatemod.ACTION_GET and wantfiledata: @@ -2195,10 +2195,10 @@ getfiledata = None else: now_sec = now[0] - for f, m in pycompat.iteritems(getfiledata): + for f, m in getfiledata.items(): if m is not None and m[2][0] >= now_sec: ambiguous_mtime[f] = (m[0], m[1], None) - for f, m in pycompat.iteritems(ambiguous_mtime): + for f, m in ambiguous_mtime.items(): getfiledata[f] = m repo.setparents(fp1, fp2) diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py --- a/mercurial/mergestate.py +++ b/mercurial/mergestate.py @@ -363,7 +363,7 @@ def unresolved(self): """Obtain the paths of unresolved files.""" - for f, entry in pycompat.iteritems(self._state): + for f, entry in self._state.items(): if entry[0] in ( MERGE_RECORD_UNRESOLVED, MERGE_RECORD_UNRESOLVED_PATH, @@ -490,7 +490,7 @@ ACTION_ADD_MODIFIED: [], ACTION_GET: [], } - for f, (r, action) in pycompat.iteritems(self._results): + for f, (r, action) in self._results.items(): if action is not None: actions[action].append((f, None, b"merge result")) return actions @@ -690,7 +690,7 @@ # the type of state that is stored, and capital-letter records are used # to prevent older versions of Mercurial that do not support the feature # from loading them. - for filename, v in pycompat.iteritems(self._state): + for filename, v in self._state.items(): if v[0] in ( MERGE_RECORD_UNRESOLVED_PATH, MERGE_RECORD_RESOLVED_PATH, @@ -714,9 +714,9 @@ else: # Normal files. These are stored in 'F' records. records.append((RECORD_MERGED, b'\0'.join([filename] + v))) - for filename, extras in sorted(pycompat.iteritems(self._stateextras)): + for filename, extras in sorted(self._stateextras.items()): rawextras = b'\0'.join( - b'%s\0%s' % (k, v) for k, v in pycompat.iteritems(extras) + b'%s\0%s' % (k, v) for k, v in extras.items() ) records.append( (RECORD_FILE_VALUES, b'%s\0%s' % (filename, rawextras)) diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py --- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -1,6 +1,5 @@ from .i18n import _ from . import ( - pycompat, registrar, templatekw, util, @@ -85,7 +84,7 @@ return self._names.get(namespace, default) def items(self): - return pycompat.iteritems(self._names) + return self._names.items() iteritems = items @@ -118,7 +117,7 @@ Raises a KeyError if there is no such node. """ - for ns, v in pycompat.iteritems(self._names): + for ns, v in self._names.items(): n = v.singlenode(repo, name) if n: return n diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -248,7 +248,7 @@ # if content cannot be translated to nodeid drop the data. parents = None - metadata = tuple(sorted(pycompat.iteritems(metadata))) + metadata = tuple(sorted(metadata.items())) yield (pre, sucs, flags, metadata, date, parents) @@ -278,7 +278,7 @@ """Return encoded metadata string to string mapping. Assume no ':' in key and no '\0' in both key and value.""" - for key, value in pycompat.iteritems(meta): + for key, value in meta.items(): if b':' in key or b'\0' in key: raise ValueError(b"':' and '\0' are forbidden in metadata key'") if b'\0' in value: @@ -652,7 +652,7 @@ 'in-marker cycle with %s' % pycompat.sysstr(hex(prec)) ) - metadata = tuple(sorted(pycompat.iteritems(metadata))) + metadata = tuple(sorted(metadata.items())) for k, v in metadata: try: # might be better to reject non-ASCII keys diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -18,7 +18,6 @@ encoding, error, phases, - pycompat, util, ) from .utils import dateutil @@ -997,7 +996,7 @@ base[tuple(nsuccset)] = n return [ {b'divergentnodes': divset, b'commonpredecessor': b} - for divset, b in pycompat.iteritems(base) + for divset, b in base.items() ] diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2643,11 +2643,7 @@ if copysourcematch: # filter out copies where source side isn't inside the matcher # (copies.pathcopies() already filtered out the destination) - copy = { - dst: src - for dst, src in pycompat.iteritems(copy) - if copysourcematch(src) - } + copy = {dst: src for dst, src in copy.items() if copysourcematch(src)} modifiedset = set(modified) addedset = set(added) diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py --- a/mercurial/pathutil.py +++ b/mercurial/pathutil.py @@ -324,7 +324,7 @@ self._dirs = {} addpath = self.addpath if isinstance(map, dict) and only_tracked: - for f, s in pycompat.iteritems(map): + for f, s in map.items(): if s.state != b'r': addpath(f) elif only_tracked: diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -219,7 +219,7 @@ The revision lists are encoded as (phase, root) pairs. """ binarydata = [] - for phase, nodes in pycompat.iteritems(phasemapping): + for phase, nodes in phasemapping.items(): for head in nodes: binarydata.append(_fphasesentry.pack(phase, head)) return b''.join(binarydata) @@ -363,9 +363,7 @@ self.invalidate() self.loadphaserevs(repo) return any( - revs - for phase, revs in pycompat.iteritems(self.phaseroots) - if phase != public + revs for phase, revs in self.phaseroots.items() if phase != public ) def nonpublicphaseroots(self, repo): @@ -383,7 +381,7 @@ return set().union( *[ revs - for phase, revs in pycompat.iteritems(self.phaseroots) + for phase, revs in self.phaseroots.items() if phase != public ] ) @@ -528,7 +526,7 @@ f.close() def _write(self, fp): - for phase, roots in pycompat.iteritems(self.phaseroots): + for phase, roots in self.phaseroots.items(): for h in sorted(roots): fp.write(b'%i %s\n' % (phase, hex(h))) self.dirty = False @@ -612,7 +610,7 @@ def retractboundary(self, repo, tr, targetphase, nodes): oldroots = { phase: revs - for phase, revs in pycompat.iteritems(self.phaseroots) + for phase, revs in self.phaseroots.items() if phase <= targetphase } if tr is None: @@ -690,7 +688,7 @@ """ filtered = False has_node = repo.changelog.index.has_node # to filter unknown nodes - for phase, nodes in pycompat.iteritems(self.phaseroots): + for phase, nodes in self.phaseroots.items(): missing = sorted(node for node in nodes if not has_node(node)) if missing: for mnode in missing: @@ -854,7 +852,7 @@ # build list from dictionary draftroots = [] has_node = repo.changelog.index.has_node # to filter unknown nodes - for nhex, phase in pycompat.iteritems(roots): + for nhex, phase in roots.items(): if nhex == b'publishing': # ignore data related to publish option continue node = bin(nhex) diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -18,7 +18,6 @@ from ..thirdparty import attr from .. import ( error, - pycompat, revlogutils, util, ) @@ -959,7 +958,7 @@ cs = stringio() write = cs.write write(b"".join(pl)) - for f, e in pycompat.iteritems(dmap): + for f, e in dmap.items(): if f in copymap: f = b"%s\0%s" % (f, copymap[f]) e = _pack( diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1305,7 +1305,7 @@ # But, obviously its parents aren't. for p in self.parents(n): heads.pop(p, None) - heads = [head for head, flag in pycompat.iteritems(heads) if flag] + heads = [head for head, flag in heads.items() if flag] roots = list(roots) assert orderedout assert roots diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -594,7 +594,7 @@ bms.add(repo[bmrev].rev()) else: matchrevs = set() - for name, bmrev in pycompat.iteritems(repo._bookmarks): + for name, bmrev in repo._bookmarks.items(): if matcher(name): matchrevs.add(bmrev) for bmrev in matchrevs: @@ -1706,7 +1706,7 @@ ) namespaces.add(repo.names[pattern]) else: - for name, ns in pycompat.iteritems(repo.names): + for name, ns in repo.names.items(): if matcher(name): namespaces.add(ns) @@ -2803,7 +2803,7 @@ def loadpredicate(ui, extname, registrarobj): """Load revset predicates from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): symbols[name] = func if func._safe: safesymbols.add(name) diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -612,7 +612,7 @@ tree = _aliasrules.expand(aliases, tree) # warn about problematic (but not referred) aliases if warn is not None: - for name, alias in sorted(pycompat.iteritems(aliases)): + for name, alias in sorted(aliases.items()): if alias.error and not alias.warned: warn(_(b'warning: %s\n') % (alias.error)) alias.warned = True diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -108,7 +108,7 @@ del subpaths[subpath] missing.add(subpath) - for subpath, ctx in sorted(pycompat.iteritems(subpaths)): + for subpath, ctx in sorted(subpaths.items()): yield subpath, ctx.sub(subpath) # Yield an empty subrepo based on ctx1 for anything only in ctx2. That way, @@ -1336,7 +1336,7 @@ ignored=False, full=False, ) - for abs, st in pycompat.iteritems(walkresults): + for abs, st in walkresults.items(): entry = dirstate.get_entry(abs) if (not entry.any_tracked) and audit_path.check(abs): unknown.append(abs) @@ -1383,7 +1383,7 @@ with repo.wlock(): wctx.forget(deleted) wctx.add(unknown) - for new, old in pycompat.iteritems(renames): + for new, old in renames.items(): wctx.copy(old, new) @@ -1509,12 +1509,9 @@ # Merge old parent and old working dir copies oldcopies = copiesmod.pathcopies(newctx, oldctx, match) oldcopies.update(copies) - copies = { - dst: oldcopies.get(src, src) - for dst, src in pycompat.iteritems(oldcopies) - } + copies = {dst: oldcopies.get(src, src) for dst, src in oldcopies.items()} # Adjust the dirstate copies - for dst, src in pycompat.iteritems(copies): + for dst, src in copies.items(): if src not in newctx or dst in newctx or not ds.get_entry(dst).added: src = None ds.copy(src, dst) diff --git a/mercurial/similar.py b/mercurial/similar.py --- a/mercurial/similar.py +++ b/mercurial/similar.py @@ -9,7 +9,6 @@ from .i18n import _ from . import ( mdiff, - pycompat, ) @@ -97,7 +96,7 @@ copies[a] = (r, myscore) progress.complete() - for dest, v in pycompat.iteritems(copies): + for dest, v in copies.items(): source, bscore = v yield source, dest, bscore diff --git a/mercurial/sparse.py b/mercurial/sparse.py --- a/mercurial/sparse.py +++ b/mercurial/sparse.py @@ -554,7 +554,7 @@ ) # Check for files that were only in the dirstate. - for file, state in pycompat.iteritems(dirstate): + for file, state in dirstate.items(): if not file in files: old = origsparsematch(file) new = sparsematch(file) diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -472,10 +472,10 @@ else: wireargs[k] = args[k] del args[k] - for k, v in sorted(pycompat.iteritems(wireargs)): + for k, v in sorted(wireargs.items()): self._pipeo.write(b"%s %d\n" % (k, len(v))) if isinstance(v, dict): - for dk, dv in pycompat.iteritems(v): + for dk, dv in v.items(): self._pipeo.write(b"%s %d\n" % (dk, len(dv))) self._pipeo.write(dv) else: diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -573,7 +573,7 @@ # compute sums for each function functiondata = [] - for fname, sitestats in pycompat.iteritems(grouped): + for fname, sitestats in grouped.items(): total_cum_sec = 0 total_self_sec = 0 total_percent = 0 @@ -652,7 +652,7 @@ else: children[site] = 1 - parents = [(parent, count) for parent, count in pycompat.iteritems(parents)] + parents = [(parent, count) for parent, count in parents.items()] parents.sort(reverse=True, key=lambda x: x[1]) for parent, count in parents: fp.write( @@ -696,7 +696,7 @@ ) ) - children = [(child, count) for child, count in pycompat.iteritems(children)] + children = [(child, count) for child, count in children.items()] children.sort(reverse=True, key=lambda x: x[1]) for child, count in children: fp.write( @@ -827,7 +827,7 @@ fd, path = pycompat.mkstemp() with open(path, b"w+") as file: - for line, count in pycompat.iteritems(lines): + for line, count in lines.items(): file.write(b"%s %d\n" % (line, count)) if outputfile is None: diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -144,7 +144,7 @@ cmap[xchr(x)] = e + xchr(x).lower() dmap = {} - for k, v in pycompat.iteritems(cmap): + for k, v in cmap.items(): dmap[v] = k def decode(s): diff --git a/mercurial/strip.py b/mercurial/strip.py --- a/mercurial/strip.py +++ b/mercurial/strip.py @@ -193,7 +193,7 @@ # a revision we have to only delete the bookmark and not strip # anything. revsets cannot detect that case. nodetobookmarks = {} - for mark, node in pycompat.iteritems(repomarks): + for mark, node in repomarks.items(): nodetobookmarks.setdefault(node, []).append(mark) for marks in nodetobookmarks.values(): if bookmarks.issuperset(marks): diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1770,7 +1770,7 @@ for b in rev2branch[self._state[1]]: if b.startswith(b'refs/remotes/origin/'): return True - for b, revision in pycompat.iteritems(branch2rev): + for b, revision in branch2rev.items(): if b.startswith(b'refs/remotes/origin/'): if self._gitisancestor(self._state[1], revision): return True diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py --- a/mercurial/subrepoutil.py +++ b/mercurial/subrepoutil.py @@ -190,7 +190,7 @@ repo.ui.debug(b" subrepo %s: %s %s\n" % (s, msg, r)) promptssrc = filemerge.partextras(labels) - for s, l in sorted(pycompat.iteritems(s1)): + for s, l in sorted(s1.items()): a = sa.get(s, nullstate) ld = l # local state with possible dirty flag for compares if wctx.sub(s).dirty(): diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -25,7 +25,6 @@ encoding, error, match as matchmod, - pycompat, scmutil, util, ) @@ -354,7 +353,7 @@ if tagtype is None: assert tagtypes is None - for name, nodehist in pycompat.iteritems(filetags): + for name, nodehist in filetags.items(): if name not in alltags: alltags[name] = nodehist if tagtype is not None: @@ -507,7 +506,7 @@ if unknown_entries: fixed_nodemap = fnodescache.refresh_invalid_nodes(unknown_entries) - for node, fnode in pycompat.iteritems(fixed_nodemap): + for node, fnode in fixed_nodemap.items(): if fnode != repo.nullid: cachefnode[node] = fnode @@ -549,7 +548,7 @@ # we keep them in UTF-8 throughout this module. If we converted # them local encoding on input, we would lose info writing them to # the cache. - for (name, (node, hist)) in sorted(pycompat.iteritems(cachetags)): + for (name, (node, hist)) in sorted(cachetags.items()): for n in hist: cachefile.write(b"%s %s\n" % (hex(n), name)) cachefile.write(b"%s %s\n" % (hex(node), name)) diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -346,7 +346,7 @@ out = [ b'"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), json(v, paranoid)) - for k, v in sorted(pycompat.iteritems(obj)) + for k, v in sorted(obj.items()) ] return b'{' + b', '.join(out) + b'}' elif util.safehasattr(obj, b'__iter__'): @@ -548,7 +548,7 @@ def loadfilter(ui, extname, registrarobj): """Load template filter from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): filters[name] = func diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -910,7 +910,7 @@ def loadfunction(ui, extname, registrarobj): """Load template function from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): funcs[name] = func diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -602,7 +602,7 @@ # 'name' for iterating over namespaces, templatename for local reference return lambda v: {b'name': v, ns.templatename: v} - for k, ns in pycompat.iteritems(repo.names): + for k, ns in repo.names.items(): names = ns.names(repo, ctx.node()) f = _showcompatlist(context, mapping, b'name', names) namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity) @@ -690,7 +690,7 @@ d.update(sub_opts) path_dict = util.sortdict() for p in ps: - sub_opts = util.sortdict(sorted(pycompat.iteritems(p.suboptions))) + sub_opts = util.sortdict(sorted(p.suboptions.items())) path_dict[b'url'] = p.rawloc path_dict.update(sub_opts) d[b'urls'] = [path_dict] @@ -1023,7 +1023,7 @@ def loadkeyword(ui, extname, registrarobj): """Load template keyword from specified registrarobj""" - for name, func in pycompat.iteritems(registrarobj._table): + for name, func in registrarobj._table.items(): keywords[name] = func diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -530,8 +530,7 @@ def compiledict(xs): return util.sortdict( - (k, compileexp(x, context, curmethods)) - for k, x in pycompat.iteritems(xs) + (k, compileexp(x, context, curmethods)) for k, x in xs.items() ) def compilelist(xs): @@ -708,7 +707,7 @@ newres = self._resources.availablekeys(newmapping) mapping = { k: v - for k, v in pycompat.iteritems(origmapping) + for k, v in origmapping.items() if ( k in knownres # not a symbol per self.symbol() or newres.isdisjoint(self._defaultrequires(k)) diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -310,7 +310,7 @@ if util.safehasattr(self._values, b'get'): values = { k: v - for k, v in pycompat.iteritems(self._values) + for k, v in self._values.items() if select(self._wrapvalue(k, v)) } else: @@ -342,10 +342,7 @@ # TODO: make it non-recursive for trivial lists/dicts xs = self._values if util.safehasattr(xs, b'get'): - return { - k: unwrapvalue(context, mapping, v) - for k, v in pycompat.iteritems(xs) - } + return {k: unwrapvalue(context, mapping, v) for k, v in xs.items()} return [unwrapvalue(context, mapping, x) for x in xs] @@ -537,7 +534,7 @@ items.append( { k: unwrapvalue(context, lm, v) - for k, v in pycompat.iteritems(nm) + for k, v in nm.items() if k not in knownres } ) @@ -715,7 +712,7 @@ This exists for backward compatibility with the old-style template. Use hybriddict() for new template keywords. """ - c = [{key: k, value: v} for k, v in pycompat.iteritems(data)] + c = [{key: k, value: v} for k, v in data.items()] f = _showcompatlist(context, mapping, name, c, plural, separator) return hybriddict(data, key=key, value=value, fmt=fmt, gen=f) diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -382,7 +382,7 @@ skip_pre = group == GEN_GROUP_POST_FINALIZE skip_post = group == GEN_GROUP_PRE_FINALIZE - for id, entry in sorted(pycompat.iteritems(self._filegenerators)): + for id, entry in sorted(self._filegenerators.items()): any = True order, filenames, genfunc, location, post_finalize = entry diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -240,7 +240,7 @@ if x.lower().startswith('proxy-') } self.send(b'CONNECT %s HTTP/1.0\r\n' % self.realhostport) - for header in pycompat.iteritems(proxyheaders): + for header in proxyheaders.items(): self.send(b'%s: %s\r\n' % header) self.send(b'\r\n') diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1301,7 +1301,7 @@ # __setitem__() isn't called as of PyPy 5.8.0 def update(self, src, **f): if isinstance(src, dict): - src = pycompat.iteritems(src) + src = src.items() for k, v in src: self[k] = v for k in f: diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py --- a/mercurial/utils/cborutil.py +++ b/mercurial/utils/cborutil.py @@ -174,9 +174,7 @@ """ yield encodelength(MAJOR_TYPE_MAP, len(d)) - for key, value in sorted( - pycompat.iteritems(d), key=lambda x: _mixedtypesortkey(x[0]) - ): + for key, value in sorted(d.items(), key=lambda x: _mixedtypesortkey(x[0])): for chunk in streamencode(key): yield chunk for chunk in streamencode(value): diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -342,7 +342,7 @@ def filter(s, cmd): """filter a string through a command that transforms its input to its output""" - for name, fn in pycompat.iteritems(_filtertable): + for name, fn in _filtertable.items(): if cmd.startswith(name): return fn(s, cmd[len(name) :].lstrip()) return pipefilter(s, cmd) @@ -448,7 +448,7 @@ env = dict(encoding.environ) if environ: - env.update((k, py2shell(v)) for k, v in pycompat.iteritems(environ)) + env.update((k, py2shell(v)) for k, v in environ.items()) env[b'HG'] = hgexecutable() return env diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py +++ b/mercurial/utils/urlutil.py @@ -453,7 +453,7 @@ """list all the (name, paths) in the passed ui""" result = [] if target_path is None: - for name, paths in sorted(pycompat.iteritems(ui.paths)): + for name, paths in sorted(ui.paths.items()): for p in paths: result.append((name, p)) @@ -919,7 +919,7 @@ # Now process the sub-options. If a sub-option is registered, its # attribute will always be present. The value will be None if there # was no valid sub-option. - for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions): + for suboption, (attr, func) in _pathsuboptions.items(): if suboption not in sub_options: setattr(self, attr, None) continue @@ -945,7 +945,7 @@ This is intended to be used for presentation purposes. """ d = {} - for subopt, (attr, _func) in pycompat.iteritems(_pathsuboptions): + for subopt, (attr, _func) in _pathsuboptions.items(): value = getattr(self, attr) if value is not None: d[subopt] = value diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -405,11 +405,11 @@ _(b'checking'), unit=_(b'manifests'), total=len(subdirs) ) - for subdir, linkrevs in pycompat.iteritems(subdirnodes): + for subdir, linkrevs in subdirnodes.items(): subdirfilenodes = self._verifymanifest( linkrevs, subdir, storefiles, subdirprogress ) - for f, onefilenodes in pycompat.iteritems(subdirfilenodes): + for f, onefilenodes in subdirfilenodes.items(): filenodes.setdefault(f, {}).update(onefilenodes) if not dir and subdirnodes: diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -122,7 +122,7 @@ def humanflags(mapping, value): """Convert a numeric flags value to a human value, using a mapping table.""" - namemap = {v: k for k, v in pycompat.iteritems(mapping)} + namemap = {v: k for k, v in mapping.items()} flags = [] val = 1 while value >= val: @@ -159,7 +159,7 @@ @encoding.strmethod def __repr__(self): typename = b'' % self.typeid - for name, value in pycompat.iteritems(FRAME_TYPES): + for name, value in FRAME_TYPES.items(): if value == self.typeid: typename = name break diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -80,8 +80,7 @@ assert all(escapearg(k) == k for k in argsdict) args = b','.join( - b'%s=%s' % (escapearg(k), escapearg(v)) - for k, v in pycompat.iteritems(argsdict) + b'%s=%s' % (escapearg(k), escapearg(v)) for k, v in argsdict.items() ) cmds.append(b'%s %s' % (op, args)) @@ -438,7 +437,7 @@ self.requirecap(b'getbundle', _(b'look up remote changes')) opts = {} bundlecaps = kwargs.get(b'bundlecaps') or set() - for key, value in pycompat.iteritems(kwargs): + for key, value in kwargs.items(): if value is None: continue keytype = wireprototypes.GETBUNDLE_ARGUMENTS.get(key) diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -235,7 +235,7 @@ def branchmap(repo, proto): branchmap = repo.branchmap() heads = [] - for branch, nodes in pycompat.iteritems(branchmap): + for branch, nodes in branchmap.items(): branchname = urlreq.quote(encoding.fromlocal(branch)) branchnodes = wireprototypes.encodelist(nodes) heads.append(b'%s %s' % (branchname, branchnodes)) @@ -432,7 +432,7 @@ opts = options( b'getbundle', wireprototypes.GETBUNDLE_ARGUMENTS.keys(), others ) - for k, v in pycompat.iteritems(opts): + for k, v in opts.items(): keytype = wireprototypes.GETBUNDLE_ARGUMENTS[k] if keytype == b'nodes': opts[k] = wireprototypes.decodelist(v)