comparison mercurial/util.py @ 23260:565f97e71ce3

sortdict: add iteritems method Future patches will start using sortdict for log operations where order is important. Adding iteritems removes the headache of having to remember to use items() if the object is a sortdict.
author Sean Farley <sean.michael.farley@gmail.com>
date Sun, 09 Nov 2014 13:15:28 -0800
parents e53f6b72a0e4
children 79858e66a7ce
comparison
equal deleted inserted replaced
23259:9f4778027bc2 23260:565f97e71ce3
367 pass 367 pass
368 def keys(self): 368 def keys(self):
369 return self._list 369 return self._list
370 def iterkeys(self): 370 def iterkeys(self):
371 return self._list.__iter__() 371 return self._list.__iter__()
372 def iteritems(self):
373 for k in self._list:
374 yield k, self[k]
372 375
373 class lrucachedict(object): 376 class lrucachedict(object):
374 '''cache most recent gets from or sets to this dictionary''' 377 '''cache most recent gets from or sets to this dictionary'''
375 def __init__(self, maxsize): 378 def __init__(self, maxsize):
376 self._cache = {} 379 self._cache = {}