comparison mercurial/logexchange.py @ 48913:f254fc73d956

global: bulk replace simple pycompat.iteritems(x) with x.items() pycompat.iteritems() just calls .items(). This commit applies a regular expression search and replace to convert simple instances of pycompat.iteritems() with .items(). There are still a handful of calls to pycompat.iteritems() remaining. But these all have more complicated expressions that I wasn't comfortable performing an automated replace on. In addition, some simple replacements were withheld because they broke pytype. These will be handled by their own changesets. Differential Revision: https://phab.mercurial-scm.org/D12318
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 03 Mar 2022 18:28:30 -0800
parents 6000f5b25c9b
children 5bceea1a8234
comparison
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
8 8
9 9
10 from .node import hex 10 from .node import hex
11 11
12 from . import ( 12 from . import (
13 pycompat,
14 util, 13 util,
15 vfs as vfsmod, 14 vfs as vfsmod,
16 ) 15 )
17 from .utils import ( 16 from .utils import (
18 urlutil, 17 urlutil,
75 # re-save the data from a different remote than this one. 74 # re-save the data from a different remote than this one.
76 for node, oldpath, rname in sorted(olddata): 75 for node, oldpath, rname in sorted(olddata):
77 if oldpath != remotepath: 76 if oldpath != remotepath:
78 f.write(b'%s\0%s\0%s\n' % (node, oldpath, rname)) 77 f.write(b'%s\0%s\0%s\n' % (node, oldpath, rname))
79 78
80 for name, node in sorted(pycompat.iteritems(names)): 79 for name, node in sorted(names.items()):
81 if nametype == b"branches": 80 if nametype == b"branches":
82 for n in node: 81 for n in node:
83 f.write(b'%s\0%s\0%s\n' % (n, remotepath, name)) 82 f.write(b'%s\0%s\0%s\n' % (n, remotepath, name))
84 elif nametype == b"bookmarks": 83 elif nametype == b"bookmarks":
85 if node: 84 if node:
157 repo = localrepo.unfiltered() 156 repo = localrepo.unfiltered()
158 157
159 with remoterepo.commandexecutor() as e: 158 with remoterepo.commandexecutor() as e:
160 branchmap = e.callcommand(b'branchmap', {}).result() 159 branchmap = e.callcommand(b'branchmap', {}).result()
161 160
162 for branch, nodes in pycompat.iteritems(branchmap): 161 for branch, nodes in branchmap.items():
163 bmap[branch] = [] 162 bmap[branch] = []
164 for node in nodes: 163 for node in nodes:
165 if node in repo and not repo[node].obsolete(): 164 if node in repo and not repo[node].obsolete():
166 bmap[branch].append(hex(node)) 165 bmap[branch].append(hex(node))
167 166