Mercurial > public > mercurial-scm > hg-stable
diff mercurial/manifest.py @ 49004: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 | 3d35e7483602 |
line wrap: on
line diff
--- a/mercurial/manifest.py Thu Mar 03 17:39:20 2022 -0800 +++ b/mercurial/manifest.py Thu Mar 03 18:28:30 2022 -0800 @@ -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