tests/test-newbranch
changeset 4177 a7af0eeae8a3
parent 4175 fc12ac3755d5
child 4179 7e1c8a565a4f
equal deleted inserted replaced
4176:f9bbcebcacea 4177:a7af0eeae8a3
    28 hg branches
    28 hg branches
    29 hg branches -q
    29 hg branches -q
    30 
    30 
    31 echo % test for invalid branch cache
    31 echo % test for invalid branch cache
    32 hg rollback
    32 hg rollback
    33 cp .hg/branches.cache .hg/bc-invalid
    33 cp .hg/branch.cache .hg/bc-invalid
    34 hg log -r foo
    34 hg log -r foo
    35 cp .hg/bc-invalid .hg/branches.cache
    35 cp .hg/bc-invalid .hg/branch.cache
    36 hg --debug log -r foo
    36 hg --debug log -r foo
    37 rm .hg/branches.cache
    37 rm .hg/branch.cache
    38 echo corrupted > .hg/branches.cache
    38 echo corrupted > .hg/branch.cache
    39 hg log -qr foo
    39 hg log -qr foo
    40 cat .hg/branches.cache
    40 cat .hg/branch.cache
    41 
       
    42 echo % test for different branch cache features
       
    43 echo '4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4' > .hg/branches.cache
       
    44 hg branches --debug
       
    45 echo ' features: unnamed dummy foo bar' > .hg/branches.cache
       
    46 hg branches --debug
       
    47 echo ' features: dummy' > .hg/branches.cache
       
    48 hg branches --debug
       
    49 
       
    50 echo % test old hg reading branch cache with feature list
       
    51 python << EOF
       
    52 import binascii
       
    53 f = file('.hg/branches.cache')
       
    54 lines = f.read().split('\n')
       
    55 f.close()
       
    56 firstline = lines[0]
       
    57 last, lrev = lines.pop(0).rstrip().split(" ", 1)
       
    58 try:
       
    59     last, lrev = binascii.unhexlify(last), int(lrev)
       
    60 except ValueError, inst:
       
    61     if str(inst) == "invalid literal for int():%s" % firstline:
       
    62         print "ValueError raised correctly, good."
       
    63     else:
       
    64         print "ValueError: %s" % inst
       
    65 EOF
       
    66 
    41 
    67 echo % update with no arguments: tipmost revision of the current branch
    42 echo % update with no arguments: tipmost revision of the current branch
    68 hg up -q -C 0
    43 hg up -q -C 0
    69 hg up -q
    44 hg up -q
    70 hg id
    45 hg id