# HG changeset patch # User Thomas Arendsen Hein # Date 1173466646 -3600 # Node ID 0182cb2e4aacf303a3a3a1164a01432a2024e981 # Parent bbfe5a3fc80c66061abfb463e800b7681c1113ed Add tests for .hg/branches.cache feature list. diff --git a/tests/test-newbranch b/tests/test-newbranch --- a/tests/test-newbranch +++ b/tests/test-newbranch @@ -38,3 +38,28 @@ rm .hg/branches.cache echo corrupted > .hg/branches.cache hg log -qr foo cat .hg/branches.cache + +echo % test for different branch cache features +echo '4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4' > .hg/branches.cache +hg branches --debug +echo ' features: unnamed dummy foo bar' > .hg/branches.cache +hg branches --debug +echo ' features: dummy' > .hg/branches.cache +hg branches --debug + +echo % test old hg reading branch cache with feature list +python << EOF +import binascii +f = file('.hg/branches.cache') +lines = f.read().split('\n') +f.close() +firstline = lines[0] +last, lrev = lines.pop(0).rstrip().split(" ", 1) +try: + last, lrev = binascii.unhexlify(last), int(lrev) +except ValueError, inst: + if str(inst) == "invalid literal for int():%s" % firstline: + print "ValueError raised correctly, good." + else: + print "ValueError: %s" % inst +EOF diff --git a/tests/test-newbranch.out b/tests/test-newbranch.out --- a/tests/test-newbranch.out +++ b/tests/test-newbranch.out @@ -79,3 +79,18 @@ 4909a3732169c0c20011c4f4b8fdff4e3d89b23f bf1bc2f45e834c75404d0ddab57d53beab56e2f8 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo 67ec16bde7f1575d523313b9bca000f6a6f12dca bar +% test for different branch cache features +branch cache: no features specified +foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f + 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8 +bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca +branch cache: unknown features: dummy, foo, bar +foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f + 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8 +bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca +branch cache: missing features: unnamed +foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f + 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8 +bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca +% test old hg reading branch cache with feature list +ValueError raised correctly, good.