view tests/test-newbranch @ 4188:dd0d9bd91e0a

dirstate.statwalk: explicitly test for ignored directories This removes a hack where we appended '/' to a dirname so that: - it would not appear on the "dc" dict - it would always be matched by the match function This was a contorted way of checking if the directory was matched by some hgignore pattern, and it would still fail with some uses of --include/--exclude patterns. Things would still work fine if we removed the check altogether and just appended things to "work" directly, but then we would end up walking ignored directories too, which could be quite a bit of work. This allows further simplification of the match function returned by util._matcher, and fixes walking the working directory with a --include pattern that matches only the end of a name.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 10 Mar 2007 23:00:54 -0300
parents fc12ac3755d5
children aee3d312c32e a7af0eeae8a3
line wrap: on
line source

#!/bin/sh

hg init t
cd t
hg branches

echo foo > a
hg add a
hg ci -m "initial" -d "1000000 0"
hg branch foo
hg branch
hg ci -m "add branch name" -d "1000000 0"
hg branch bar
hg ci -m "change branch name" -d "1000000 0"
hg branch ""
hg ci -m "clear branch name" -d "1000000 0"

hg co foo
hg branch
echo bleah > a
hg ci -m "modify a branch" -d "1000000 0"

hg merge
hg branch
hg ci -m "merge" -d "1000000 0"
hg log

hg branches
hg branches -q

echo % test for invalid branch cache
hg rollback
cp .hg/branches.cache .hg/bc-invalid
hg log -r foo
cp .hg/bc-invalid .hg/branches.cache
hg --debug log -r foo
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

echo % update with no arguments: tipmost revision of the current branch
hg up -q -C 0
hg up -q
hg id
hg up -q 1
hg up -q
hg id