tests/test-tags
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 28 Oct 2006 23:37:59 -0300
changeset 3577 7f7425306925
parent 2973 fb493241d7f6
child 4143 26314500a5e1
permissions -rwxr-xr-x
Correct optimization from 3464f5e77f34; add a test. If there are two (or more) heads that point to the same .hgtags node, we can safely skip parsing the file in all but the last head. (In 3464f5e77f34, we were parsing the file in the first head and skipping all the others.)
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
2973
fb493241d7f6 Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents: 2320
diff changeset
    12
T=`hg tip --debug | 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
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    63
# tags from later heads override previous ones
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    64
cd ..
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    65
hg init t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    66
cd t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    67
echo foo > foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    68
hg add foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    69
hg ci -m 'add foo' -d '1000000 0'      # rev 0
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    70
hg tag -d '1000000 0' bar              # rev 1
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    71
echo >> foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    72
hg ci -m 'change foo 1' -d '1000000 0' # rev 2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    73
hg up -C 1
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    74
hg tag -r 1 -d '1000000 0' bar         # rev 3
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    75
hg up -C 1
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    76
echo >> foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    77
hg ci -m 'change foo 2' -d '1000000 0' # rev 4
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2973
diff changeset
    78
hg tags