comparison mercurial/revlog.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 c59eb1560c44
children 8ff1ecfadcd1
comparison
equal deleted inserted replaced
43105:649d3ac37a12 43106:d783f945a701
442 self._srmingapsize = opts[b'sparse-read-min-gap-size'] 442 self._srmingapsize = opts[b'sparse-read-min-gap-size']
443 if opts.get(b'enableellipsis'): 443 if opts.get(b'enableellipsis'):
444 self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor 444 self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor
445 445
446 # revlog v0 doesn't have flag processors 446 # revlog v0 doesn't have flag processors
447 for flag, processor in opts.get(b'flagprocessors', {}).iteritems(): 447 for flag, processor in pycompat.iteritems(
448 opts.get(b'flagprocessors', {})
449 ):
448 flagutil.insertflagprocessor(flag, processor, self._flagprocessors) 450 flagutil.insertflagprocessor(flag, processor, self._flagprocessors)
449 451
450 if self._chunkcachesize <= 0: 452 if self._chunkcachesize <= 0:
451 raise error.RevlogError( 453 raise error.RevlogError(
452 _(b'revlog chunk cache size %r is not ' b'greater than 0') 454 _(b'revlog chunk cache size %r is not ' b'greater than 0')
1139 # will eventually remove it. 1141 # will eventually remove it.
1140 heads[n] = True 1142 heads[n] = True
1141 # But, obviously its parents aren't. 1143 # But, obviously its parents aren't.
1142 for p in self.parents(n): 1144 for p in self.parents(n):
1143 heads.pop(p, None) 1145 heads.pop(p, None)
1144 heads = [head for head, flag in heads.iteritems() if flag] 1146 heads = [head for head, flag in pycompat.iteritems(heads) if flag]
1145 roots = list(roots) 1147 roots = list(roots)
1146 assert orderedout 1148 assert orderedout
1147 assert roots 1149 assert roots
1148 assert heads 1150 assert heads
1149 return (orderedout, roots, heads) 1151 return (orderedout, roots, heads)