comparison mercurial/sparse.py @ 43106:d783f945a701

py3: finish porting iteritems() to pycompat and remove source transformer This commit finishes porting .iteritems() to pycompat.iteritems() for the mercurial package. The translation of .iteritems() to .items() was the last conversion performed by the source transformer. With the porting to pycompat complete, we no longer have a need for the source transformer. So the source transformer has been removed. Good riddance! The code base is now compatible with Python 2 and Python 3. For the record, as the person who introduced the source transformer, it brings me joy to delete it. It accomplished its goal to facilitate a port to Python 3 without overly burdening people on some painful low-level differences between Python 2 and 3. It is unfortunate we still have to wallpaper over many differences with the pycompat shim. But it is what it is. Differential Revision: https://phab.mercurial-scm.org/D7015
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 07 Oct 2019 00:04:04 -0400
parents 687b865b95ad
children 8ff1ecfadcd1
comparison
equal deleted inserted replaced
43105:649d3ac37a12 43106:d783f945a701
387 # If we're updating, use the target context's filter, since we're 387 # If we're updating, use the target context's filter, since we're
388 # moving to the target context. 388 # moving to the target context.
389 sparsematch = matcher(repo, [mctx.rev()]) 389 sparsematch = matcher(repo, [mctx.rev()])
390 390
391 temporaryfiles = [] 391 temporaryfiles = []
392 for file, action in actions.iteritems(): 392 for file, action in pycompat.iteritems(actions):
393 type, args, msg = action 393 type, args, msg = action
394 files.add(file) 394 files.add(file)
395 if sparsematch(file): 395 if sparsematch(file):
396 prunedactions[file] = action 396 prunedactions[file] = action
397 elif type == b'm': 397 elif type == b'm':
530 b'--force to bring them back dirty)' 530 b'--force to bring them back dirty)'
531 ) 531 )
532 ) 532 )
533 533
534 # Check for files that were only in the dirstate. 534 # Check for files that were only in the dirstate.
535 for file, state in dirstate.iteritems(): 535 for file, state in pycompat.iteritems(dirstate):
536 if not file in files: 536 if not file in files:
537 old = origsparsematch(file) 537 old = origsparsematch(file)
538 new = sparsematch(file) 538 new = sparsematch(file)
539 if old and not new: 539 if old and not new:
540 dropped.append(file) 540 dropped.append(file)
541 541
542 # Apply changes to disk 542 # Apply changes to disk
543 typeactions = mergemod.emptyactions() 543 typeactions = mergemod.emptyactions()
544 for f, (m, args, msg) in actions.iteritems(): 544 for f, (m, args, msg) in pycompat.iteritems(actions):
545 typeactions[m].append((f, args, msg)) 545 typeactions[m].append((f, args, msg))
546 546
547 mergemod.applyupdates( 547 mergemod.applyupdates(
548 repo, typeactions, repo[None], repo[b'.'], False, wantfiledata=False 548 repo, typeactions, repo[None], repo[b'.'], False, wantfiledata=False
549 ) 549 )