Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.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 | 06de08b36c82 |
comparison
equal
deleted
inserted
replaced
48912:a0674e916fb6 | 48913:f254fc73d956 |
---|---|
106 for subpath in ctx2.substate: | 106 for subpath in ctx2.substate: |
107 if subpath not in ctx1.substate: | 107 if subpath not in ctx1.substate: |
108 del subpaths[subpath] | 108 del subpaths[subpath] |
109 missing.add(subpath) | 109 missing.add(subpath) |
110 | 110 |
111 for subpath, ctx in sorted(pycompat.iteritems(subpaths)): | 111 for subpath, ctx in sorted(subpaths.items()): |
112 yield subpath, ctx.sub(subpath) | 112 yield subpath, ctx.sub(subpath) |
113 | 113 |
114 # Yield an empty subrepo based on ctx1 for anything only in ctx2. That way, | 114 # Yield an empty subrepo based on ctx1 for anything only in ctx2. That way, |
115 # status and diff will have an accurate result when it does | 115 # status and diff will have an accurate result when it does |
116 # 'sub.{status|diff}(rev2)'. Otherwise, the ctx2 subrepo is compared | 116 # 'sub.{status|diff}(rev2)'. Otherwise, the ctx2 subrepo is compared |
1334 subrepos=sorted(ctx.substate), | 1334 subrepos=sorted(ctx.substate), |
1335 unknown=True, | 1335 unknown=True, |
1336 ignored=False, | 1336 ignored=False, |
1337 full=False, | 1337 full=False, |
1338 ) | 1338 ) |
1339 for abs, st in pycompat.iteritems(walkresults): | 1339 for abs, st in walkresults.items(): |
1340 entry = dirstate.get_entry(abs) | 1340 entry = dirstate.get_entry(abs) |
1341 if (not entry.any_tracked) and audit_path.check(abs): | 1341 if (not entry.any_tracked) and audit_path.check(abs): |
1342 unknown.append(abs) | 1342 unknown.append(abs) |
1343 elif (not entry.removed) and not st: | 1343 elif (not entry.removed) and not st: |
1344 deleted.append(abs) | 1344 deleted.append(abs) |
1381 and the files in renames as copied.""" | 1381 and the files in renames as copied.""" |
1382 wctx = repo[None] | 1382 wctx = repo[None] |
1383 with repo.wlock(): | 1383 with repo.wlock(): |
1384 wctx.forget(deleted) | 1384 wctx.forget(deleted) |
1385 wctx.add(unknown) | 1385 wctx.add(unknown) |
1386 for new, old in pycompat.iteritems(renames): | 1386 for new, old in renames.items(): |
1387 wctx.copy(old, new) | 1387 wctx.copy(old, new) |
1388 | 1388 |
1389 | 1389 |
1390 def getrenamedfn(repo, endrev=None): | 1390 def getrenamedfn(repo, endrev=None): |
1391 if copiesmod.usechangesetcentricalgo(repo): | 1391 if copiesmod.usechangesetcentricalgo(repo): |
1507 ds.update_file_p1(f, p1_tracked=True) | 1507 ds.update_file_p1(f, p1_tracked=True) |
1508 | 1508 |
1509 # Merge old parent and old working dir copies | 1509 # Merge old parent and old working dir copies |
1510 oldcopies = copiesmod.pathcopies(newctx, oldctx, match) | 1510 oldcopies = copiesmod.pathcopies(newctx, oldctx, match) |
1511 oldcopies.update(copies) | 1511 oldcopies.update(copies) |
1512 copies = { | 1512 copies = {dst: oldcopies.get(src, src) for dst, src in oldcopies.items()} |
1513 dst: oldcopies.get(src, src) | |
1514 for dst, src in pycompat.iteritems(oldcopies) | |
1515 } | |
1516 # Adjust the dirstate copies | 1513 # Adjust the dirstate copies |
1517 for dst, src in pycompat.iteritems(copies): | 1514 for dst, src in copies.items(): |
1518 if src not in newctx or dst in newctx or not ds.get_entry(dst).added: | 1515 if src not in newctx or dst in newctx or not ds.get_entry(dst).added: |
1519 src = None | 1516 src = None |
1520 ds.copy(src, dst) | 1517 ds.copy(src, dst) |
1521 repo._quick_access_changeid_invalidate() | 1518 repo._quick_access_changeid_invalidate() |
1522 | 1519 |