Mercurial > hg
comparison mercurial/dirstatemap.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 | 642e31cb55f0 |
comparison
equal
deleted
inserted
replaced
48912:a0674e916fb6 | 48913:f254fc73d956 |
---|---|
10 | 10 |
11 from . import ( | 11 from . import ( |
12 error, | 12 error, |
13 pathutil, | 13 pathutil, |
14 policy, | 14 policy, |
15 pycompat, | |
16 txnutil, | 15 txnutil, |
17 util, | 16 util, |
18 ) | 17 ) |
19 | 18 |
20 from .dirstateutils import ( | 19 from .dirstateutils import ( |
352 util.clearcachedproperty(self, b"_alldirs") | 351 util.clearcachedproperty(self, b"_alldirs") |
353 util.clearcachedproperty(self, b"filefoldmap") | 352 util.clearcachedproperty(self, b"filefoldmap") |
354 util.clearcachedproperty(self, b"dirfoldmap") | 353 util.clearcachedproperty(self, b"dirfoldmap") |
355 | 354 |
356 def items(self): | 355 def items(self): |
357 return pycompat.iteritems(self._map) | 356 return self._map.items() |
358 | 357 |
359 # forward for python2,3 compat | 358 # forward for python2,3 compat |
360 iteritems = items | 359 iteritems = items |
361 | 360 |
362 def debug_iter(self, all): | 361 def debug_iter(self, all): |
376 def setparents(self, p1, p2, fold_p2=False): | 375 def setparents(self, p1, p2, fold_p2=False): |
377 self._parents = (p1, p2) | 376 self._parents = (p1, p2) |
378 self._dirtyparents = True | 377 self._dirtyparents = True |
379 copies = {} | 378 copies = {} |
380 if fold_p2: | 379 if fold_p2: |
381 for f, s in pycompat.iteritems(self._map): | 380 for f, s in self._map.items(): |
382 # Discard "merged" markers when moving away from a merge state | 381 # Discard "merged" markers when moving away from a merge state |
383 if s.p2_info: | 382 if s.p2_info: |
384 source = self.copymap.pop(f, None) | 383 source = self.copymap.pop(f, None) |
385 if source: | 384 if source: |
386 copies[f] = source | 385 copies[f] = source |
499 self._map, util.normcasespec, util.normcasefallback | 498 self._map, util.normcasespec, util.normcasefallback |
500 ) | 499 ) |
501 | 500 |
502 f = {} | 501 f = {} |
503 normcase = util.normcase | 502 normcase = util.normcase |
504 for name, s in pycompat.iteritems(self._map): | 503 for name, s in self._map.items(): |
505 if not s.removed: | 504 if not s.removed: |
506 f[normcase(name)] = name | 505 f[normcase(name)] = name |
507 f[b'.'] = b'.' # prevents useless util.fspath() invocation | 506 f[b'.'] = b'.' # prevents useless util.fspath() invocation |
508 return f | 507 return f |
509 | 508 |