tests/test-tags
author Vadim Gelfer <vadim.gelfer@gmail.com>
Thu, 18 May 2006 23:31:12 -0700
changeset 2320 dbdce3b99988
parent 2283 e506c14382fd
child 2966 fb493241d7f6
permissions -rwxr-xr-x
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 345
diff changeset
     1
#!/bin/sh
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     2
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     3
mkdir t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     4
cd t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     5
hg init
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     6
hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     7
echo a > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     8
hg add a
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 925
diff changeset
     9
hg commit -m "test" -d "1000000 0"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    10
hg co
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    11
hg identify
925
5a034646e472 run-tests: remove '+ hg' trick
mpm@selenic.com
parents: 814
diff changeset
    12
T=`hg tip -v | head -n 1 | cut -d : -f 3`
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    13
echo "$T first" > .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    14
cat .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    15
hg add .hgtags
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 925
diff changeset
    16
hg commit -m "add tags" -d "1000000 0"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    17
hg tags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    18
hg identify
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    19
echo bb > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    20
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    21
hg identify
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    22
hg co first
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    23
hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    24
hg -v id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    25
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    26
echo 1 > b
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    27
hg add b
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 925
diff changeset
    28
hg commit -m "branch" -d "1000000 0"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    29
hg id
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1986
diff changeset
    30
hg merge 1
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    31
hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    32
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    33
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    34
hg commit -m "merge" -d "1000000 0"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    35
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    36
# create fake head, make sure tag not visible afterwards
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    37
cp .hgtags tags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    38
hg tag -d "1000000 0" last
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    39
hg rm .hgtags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    40
hg commit -m "remove" -d "1000000 0"
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    41
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    42
mv tags .hgtags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    43
hg add .hgtags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    44
hg commit -m "readd" -d "1000000 0"
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    45
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    46
hg tags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    47
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    48
# invalid tags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    49
echo "spam" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    50
echo >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    51
echo "foo bar" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    52
echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    53
hg commit -m "tags" -d "1000000 0"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    54
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    55
# report tag parse error on other head
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    56
hg up 3
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    57
echo 'x y' >> .hgtags
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    58
hg commit -m "head" -d "1000000 0"
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    59
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    60
hg tags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    61
hg tip
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    62