comparison mercurial/util.py @ 23261:79858e66a7ce

sortdict: add insert method Future patches will allow extensions to choose which order a namespace should output in the log, so we add a way for sortdict to insert to a specific location.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 15 Oct 2014 12:39:19 -0700
parents 565f97e71ce3
children 76302f5ceba4
comparison
equal deleted inserted replaced
23260:565f97e71ce3 23261:79858e66a7ce
370 def iterkeys(self): 370 def iterkeys(self):
371 return self._list.__iter__() 371 return self._list.__iter__()
372 def iteritems(self): 372 def iteritems(self):
373 for k in self._list: 373 for k in self._list:
374 yield k, self[k] 374 yield k, self[k]
375 def insert(self, index, key, val):
376 self._list.insert(index, key)
377 dict.__setitem__(self, key, val)
375 378
376 class lrucachedict(object): 379 class lrucachedict(object):
377 '''cache most recent gets from or sets to this dictionary''' 380 '''cache most recent gets from or sets to this dictionary'''
378 def __init__(self, maxsize): 381 def __init__(self, maxsize):
379 self._cache = {} 382 self._cache = {}