view tests/test-tags @ 2320:dbdce3b99988

fix parsing of tags. make parse errors useful. add new tag tests. old code read every head of .hgtags. delete and recreate of .hgtags gave new head, but if error in deleted rev, .hgtags had error messages every time it was parsed. this was very hard to fix, because deleted revs hard to get back and update, needed merges too. new code reads .hgtags on every head. advantage is if parse error happens with new code, is possible to fix them by editing .hgtags on a head and committing. NOTE: new code uses binary search of manifest of each head to be fast, but still much slower than old code. best thing would be to have delete record stored in filelog so we never touch manifest. could find live heads directly from filelog. this is more work than i want now. new tests check for parse of tags on different heads, and inaccessible heads created by delete and recreate of .hgtags.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 18 May 2006 23:31:12 -0700
parents e506c14382fd
children
line wrap: on
line source

#!/bin/sh

mkdir t
cd t
hg init
hg id
echo a > a
hg add a
hg commit -m "test" -d "1000000 0"
hg co
hg identify
T=`hg tip -v | head -n 1 | cut -d : -f 3`
echo "$T first" > .hgtags
cat .hgtags
hg add .hgtags
hg commit -m "add tags" -d "1000000 0"
hg tags
hg identify
echo bb > a
hg status
hg identify
hg co first
hg id
hg -v id
hg status
echo 1 > b
hg add b
hg commit -m "branch" -d "1000000 0"
hg id
hg merge 1
hg id
hg status

hg commit -m "merge" -d "1000000 0"

# create fake head, make sure tag not visible afterwards
cp .hgtags tags
hg tag -d "1000000 0" last
hg rm .hgtags
hg commit -m "remove" -d "1000000 0"

mv tags .hgtags
hg add .hgtags
hg commit -m "readd" -d "1000000 0"

hg tags

# invalid tags
echo "spam" >> .hgtags
echo >> .hgtags
echo "foo bar" >> .hgtags
echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags
hg commit -m "tags" -d "1000000 0"

# report tag parse error on other head
hg up 3
echo 'x y' >> .hgtags
hg commit -m "head" -d "1000000 0"

hg tags
hg tip