##// END OF EJS Templates
histedit: more precise user message when changeset is missing...
histedit: more precise user message when changeset is missing Now that we explicitly detect duplicated changesets, we can explicitly detect missing ones. We cover the same cases as before, some others and we offer a better error message in all cases.

File last commit:

r18603:2251b318 default
r19048:1163ff06 default
Show More
test-lrucachedict.py
35 lines | 807 B | text/x-python | PythonLexer
/ tests / test-lrucachedict.py
from mercurial import util
def printifpresent(d, xs):
for x in xs:
present = x in d
print "'%s' in d: %s" % (x, present)
if present:
print "d['%s']: %s" % (x, d[x])
def test_lrucachedict():
d = util.lrucachedict(4)
d['a'] = 'va'
d['b'] = 'vb'
d['c'] = 'vc'
d['d'] = 'vd'
# all of these should be present
printifpresent(d, ['a', 'b', 'c', 'd'])
# 'a' should be dropped because it was least recently used
d['e'] = 've'
printifpresent(d, ['a', 'b', 'c', 'd', 'e'])
# touch entries in some order (get or set).
d['e']
d['c'] = 'vc2'
d['d']
d['b'] = 'vb2'
# 'e' should be dropped now
d['f'] = 'vf'
printifpresent(d, ['b', 'c', 'd', 'e', 'f'])
if __name__ == '__main__':
test_lrucachedict()