diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -242,6 +242,10 @@ class lrucachedict(object): def __contains__(self, key): return key in self._cache + def clear(self): + self._cache.clear() + self._order = deque() + def lrucachefunc(func): '''cache most recent results of function calls''' cache = {} diff --git a/tests/test-lrucachedict.py b/tests/test-lrucachedict.py --- a/tests/test-lrucachedict.py +++ b/tests/test-lrucachedict.py @@ -31,5 +31,8 @@ def test_lrucachedict(): d['f'] = 'vf' printifpresent(d, ['b', 'c', 'd', 'e', 'f']) + d.clear() + printifpresent(d, ['b', 'c', 'd', 'e', 'f']) + if __name__ == '__main__': test_lrucachedict() diff --git a/tests/test-lrucachedict.py.out b/tests/test-lrucachedict.py.out --- a/tests/test-lrucachedict.py.out +++ b/tests/test-lrucachedict.py.out @@ -24,3 +24,8 @@ d['d']: vd 'e' in d: False 'f' in d: True d['f']: vf +'b' in d: False +'c' in d: False +'d' in d: False +'e' in d: False +'f' in d: False