tests/test-tags
author Greg Ward <greg-hg@gerg.ca>
Thu, 16 Jul 2009 10:41:19 -0400
changeset 9152 4017291c4c48
parent 9151 f528d1a93491
child 9366 9ff178e7b627
permissions -rwxr-xr-x
tags: support 'instant' tag retrieval (issue548) - modify _readtagcache() and _writetagcache() to read/write tag->node mapping for global tags - if (and only if) tip unchanged, use that cached mapping to avoid reading any revisions of .hgtags - change so tag names are UTF-8 in memory in tags.py, and converted to local encoding as late as possible (in localrepository._findtags())
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
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
     3
cacheexists() {
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
     4
    [ -f .hg/tags.cache ] && echo "tag cache exists" || echo "no tag cache"
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
     5
}
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
     6
9152
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
     7
# XXX need to test that the tag cache works when we strip an old head
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
     8
# and add a new one rooted off non-tip: i.e. node and rev of tip are the
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
     9
# same, but stuff has changed behind tip.
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
    10
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    11
echo "% setup"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    12
mkdir t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    13
cd t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    14
hg init
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    15
cacheexists
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    16
hg id
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    17
cacheexists
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    18
echo a > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    19
hg add a
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    20
hg commit -m "test"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    21
hg co
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    22
hg identify
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    23
cacheexists
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    24
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    25
echo "% create local tag with long name"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    26
T=`hg identify --debug --id`
4143
26314500a5e1 Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3577
diff changeset
    27
hg tag -l "This is a local tag with a really long name!"
26314500a5e1 Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3577
diff changeset
    28
hg tags
26314500a5e1 Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3577
diff changeset
    29
rm .hg/localtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    30
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    31
echo "% create a tag behind hg's back"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    32
echo "$T first" > .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    33
cat .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    34
hg add .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    35
hg commit -m "add tags"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    36
hg tags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    37
hg identify
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    38
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    39
# repeat with cold tag cache
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    40
rm -f .hg/tags.cache
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    41
hg identify
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    42
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    43
echo "% create a branch"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    44
echo bb > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    45
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    46
hg identify
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    47
hg co first
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    48
hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    49
hg -v id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    50
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    51
echo 1 > b
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    52
hg add b
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    53
hg commit -m "branch"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    54
hg id
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    55
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    56
echo "% merge the two heads"
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1986
diff changeset
    57
hg merge 1
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    58
hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    59
hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
    60
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    61
hg commit -m "merge"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    62
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    63
echo "% create fake head, make sure tag not visible afterwards"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    64
cp .hgtags tags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    65
hg tag last
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    66
hg rm .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    67
hg commit -m "remove"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    68
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    69
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
    70
hg add .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    71
hg commit -m "readd"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    72
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    73
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
    74
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    75
echo "% add invalid tags"
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    76
echo "spam" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    77
echo >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    78
echo "foo bar" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    79
echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    80
echo "committing .hgtags:"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    81
cat .hgtags 
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    82
hg commit -m "tags"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    83
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    84
echo "% report tag parse error on other head"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    85
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
    86
echo 'x y' >> .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    87
hg commit -m "head"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
    88
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    89
hg tags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    90
hg tip
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    91
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    92
echo "% test tag precedence rules"
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
    93
cd ..
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
    94
hg init t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
    95
cd t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
    96
echo foo > foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
    97
hg add foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    98
hg ci -m 'add foo'      # rev 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    99
hg tag bar              # rev 1
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
   100
echo >> foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   101
hg ci -m 'change foo 1' # rev 2
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
   102
hg up -C 1
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   103
hg tag -r 1 -f bar      # rev 3
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
   104
hg up -C 1
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
   105
echo >> foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   106
hg ci -m 'change foo 2' # rev 4
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
   107
hg tags
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   108
hg tags         # repeat in case of cache effects
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   109
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   110
dumptags() {
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   111
    rev=$1
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   112
    echo "rev $rev: .hgtags:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   113
    hg cat -r$rev .hgtags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   114
}
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   115
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   116
echo "% detailed dump of tag info"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   117
echo "heads:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   118
hg heads -q             # expect 4, 3, 2
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   119
dumptags 2
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   120
dumptags 3
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   121
dumptags 4
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   122
echo ".hg/tags.cache:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   123
[ -f .hg/tags.cache ] && cat .hg/tags.cache || echo "no such file"
4213
3be4785f8994 tags: add --remove
Matt Mackall <mpm@selenic.com>
parents: 4211
diff changeset
   124
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   125
echo "% test tag removal"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   126
hg tag --remove bar     # rev 5
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   127
hg tip -vp
4213
3be4785f8994 tags: add --remove
Matt Mackall <mpm@selenic.com>
parents: 4211
diff changeset
   128
hg tags
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   129
hg tags                 # again, try to expose cache bugs
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   130
4651
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
   131
echo '% remove nonexistent tag'
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   132
hg tag --remove foobar
4651
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
   133
hg tip
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
   134
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   135
echo "% rollback undoes tag operation"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   136
hg rollback             # destroy rev 5 (restore bar)
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   137
hg tags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   138
hg tags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   139
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   140
echo "% test tag rank"
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   141
cd ..
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   142
hg init t3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   143
cd t3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   144
echo foo > foo
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   145
hg add foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   146
hg ci -m 'add foo'       # rev 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   147
hg tag -f bar            # rev 1 bar -> 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   148
hg tag -f bar            # rev 2 bar -> 1
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   149
hg tag -fr 0 bar         # rev 3 bar -> 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   150
hg tag -fr 1 bar         # rev 4 bar -> 1
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   151
hg tag -fr 0 bar         # rev 5 bar -> 0
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   152
hg tags
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   153
hg co 3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   154
echo barbar > foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   155
hg ci -m 'change foo'    # rev 6
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   156
hg tags
4267
8185a1ca8628 tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents: 4266
diff changeset
   157
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   158
echo "% don't allow moving tag without -f"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   159
hg tag -r 3 bar
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   160
hg tags
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   161
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   162
echo "% strip 1: expose an old head"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   163
hg --config extensions.mq= strip 5 > /dev/null 2>&1
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   164
hg tags                  # partly stale cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   165
hg tags                  # up-to-date cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   166
echo "% strip 2: destroy whole branch, no old head exposed"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   167
hg --config extensions.mq= strip 4 > /dev/null 2>&1 
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   168
hg tags                  # partly stale
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   169
rm -f .hg/tags.cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   170
hg tags                  # cold cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   171
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   172
echo "% test tag rank with 3 heads"
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   173
cd ..
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   174
hg init t4
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   175
cd t4
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   176
echo foo > foo
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   177
hg add
5524
453acf64f71f run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
   178
hg ci -m 'add foo'                 # rev 0
453acf64f71f run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
   179
hg tag bar                         # rev 1 bar -> 0
453acf64f71f run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
   180
hg tag -f bar                      # rev 2 bar -> 1
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   181
hg up -qC 0
5524
453acf64f71f run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
   182
hg tag -fr 2 bar                   # rev 3 bar -> 2
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   183
hg tags
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   184
hg up -qC 0
5524
453acf64f71f run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
   185
hg tag -m 'retag rev 0' -fr 0 bar  # rev 4 bar -> 0, but bar stays at 2
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   186
echo "% bar should still point to rev 2"
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   187
hg tags
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   188
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   189
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   190
echo "% remove local as global and global as local"
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   191
# test that removing global/local tags does not get confused when trying
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   192
# to remove a tag of type X which actually only exists as a type Y
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   193
cd ..
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   194
hg init t5
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   195
cd t5
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   196
echo foo > foo
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   197
hg add
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   198
hg ci -m 'add foo'                 # rev 0
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   199
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   200
hg tag -r 0 -l localtag
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   201
hg tag --remove localtag
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   202
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   203
hg tag -r 0 globaltag
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   204
hg tag --remove -l globaltag
5658
ae3089cefaab Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents: 5657
diff changeset
   205
hg tags -v
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   206
exit 0