tests/test-tags.t
author Matt Mackall <mpm@selenic.com>
Sun, 23 Oct 2011 16:32:27 -0500
branchstable
changeset 15348 c681e478c429
parent 15243 1e9451476bf8
child 15443 a1914d214579
permissions -rw-r--r--
windows: sanity-check symlink placeholders On Windows, we store symlinks as plain files with the link contents. Via user error or NFS/Samba assistance, these files often end up with 'normal' file contents. Committing these changes thus gives an invalid symlink that can't be checked out on Unix. Here we filter out any modified symlink placeholders that look suspicious when computing status: - more than 1K (looks more like a normal file) - contain NULs (not allowed on Unix, probably a binary) - contains \n (filenames can't contain \n, very unusual for symlinks, very common for files)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     1
Helper functions:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     3
  $ cacheexists() {
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
     4
  >   [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache"
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     5
  > }
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
     6
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     7
  $ dumptags() {
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     8
  >     rev=$1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
     9
  >     echo "rev $rev: .hgtags:"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    10
  >     hg cat -r$rev .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    11
  > }
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    12
9152
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
    13
# 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
    14
# 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
    15
# same, but stuff has changed behind tip.
4017291c4c48 tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents: 9151
diff changeset
    16
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    17
Setup:
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    18
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    19
  $ hg init t
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    20
  $ cd t
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    21
  $ cacheexists
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    22
  no tag cache
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    23
  $ hg id
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    24
  000000000000 tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    25
  $ cacheexists
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    26
  no tag cache
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    27
  $ echo a > a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    28
  $ hg add a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    29
  $ hg commit -m "test"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    30
  $ hg co
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    31
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    32
  $ hg identify
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    33
  acb14030fe0a tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    34
  $ cacheexists
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    35
  tag cache exists
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    36
12758
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    37
Try corrupting the cache
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    38
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
    39
  $ printf 'a b' > .hg/cache/tags
12758
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    40
  $ hg identify
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
    41
  .hg/cache/tags is corrupt, rebuilding it
12758
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    42
  acb14030fe0a tip
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    43
  $ cacheexists
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    44
  tag cache exists
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    45
  $ hg identify
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    46
  acb14030fe0a tip
2d754eae430c tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12640
diff changeset
    47
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    48
Create local tag with long name:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    49
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    50
  $ T=`hg identify --debug --id`
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    51
  $ hg tag -l "This is a local tag with a really long name!"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    52
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    53
  tip                                0:acb14030fe0a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    54
  This is a local tag with a really long name!     0:acb14030fe0a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    55
  $ rm .hg/localtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    56
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    57
Create a tag behind hg's back:
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    58
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    59
  $ echo "$T first" > .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    60
  $ cat .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    61
  acb14030fe0a21b60322c440ad2d20cf7685a376 first
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    62
  $ hg add .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    63
  $ hg commit -m "add tags"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    64
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    65
  tip                                1:b9154636be93
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    66
  first                              0:acb14030fe0a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    67
  $ hg identify
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    68
  b9154636be93 tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    69
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    70
Repeat with cold tag cache:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    71
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
    72
  $ rm -f .hg/cache/tags
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    73
  $ hg identify
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    74
  b9154636be93 tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    75
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    76
And again, but now unable to write tag cache:
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
    77
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
    78
  $ rm -f .hg/cache/tags
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    79
  $ chmod 555 .hg
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    80
  $ hg identify
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    81
  b9154636be93 tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    82
  $ chmod 755 .hg
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    83
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    84
Create a branch:
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
    85
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    86
  $ echo bb > a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    87
  $ hg status
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    88
  M a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    89
  $ hg identify
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    90
  b9154636be93+ tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    91
  $ hg co first
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    92
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    93
  $ hg id
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    94
  acb14030fe0a+ first
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    95
  $ hg -v id
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    96
  acb14030fe0a+ first
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    97
  $ hg status
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    98
  M a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
    99
  $ echo 1 > b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   100
  $ hg add b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   101
  $ hg commit -m "branch"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   102
  created new head
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   103
  $ hg id
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   104
  c8edf04160c7 tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   105
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   106
Merge the two heads:
9366
9ff178e7b627 tags: don't crash if unable to write tag cache
Greg Ward <greg-hg@gerg.ca>
parents: 9152
diff changeset
   107
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   108
  $ hg merge 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   109
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   110
  (branch merge, don't forget to commit)
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   111
  $ hg id
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   112
  c8edf04160c7+b9154636be93+ tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   113
  $ hg status
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   114
  M .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   115
  $ hg commit -m "merge"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   116
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   117
Create a fake head, make sure tag not visible afterwards:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   118
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   119
  $ cp .hgtags tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   120
  $ hg tag last
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   121
  $ hg rm .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   122
  $ hg commit -m "remove"
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
   123
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   124
  $ mv tags .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   125
  $ hg add .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   126
  $ hg commit -m "readd"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   127
  $ 
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   128
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   129
  tip                                6:35ff301afafe
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   130
  first                              0:acb14030fe0a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   131
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   132
Add invalid tags:
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
   133
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   134
  $ echo "spam" >> .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   135
  $ echo >> .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   136
  $ echo "foo bar" >> .hgtags
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   137
  $ echo "a5a5 invalid" >> .hg/localtags
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   138
  $ cat .hgtags 
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   139
  acb14030fe0a21b60322c440ad2d20cf7685a376 first
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   140
  spam
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   141
  
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   142
  foo bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   143
  $ hg commit -m "tags"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   144
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   145
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
   146
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   147
  $ hg up 3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   148
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   149
  $ echo 'x y' >> .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   150
  $ hg commit -m "head"
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   151
  created new 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
   152
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   153
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   154
  .hgtags@75d9f02dfe28, line 2: cannot parse entry
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   155
  .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   156
  .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   157
  tip                                8:c4be69a18c11
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   158
  first                              0:acb14030fe0a
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   159
  $ hg tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   160
  changeset:   8:c4be69a18c11
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   161
  tag:         tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   162
  parent:      3:ac5e980c4dc0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   163
  user:        test
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   164
  date:        Thu Jan 01 00:00:00 1970 +0000
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   165
  summary:     head
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   166
  
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
   167
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   168
Test tag precedence rules:
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
   169
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   170
  $ cd ..
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   171
  $ hg init t2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   172
  $ cd t2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   173
  $ echo foo > foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   174
  $ hg add foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   175
  $ hg ci -m 'add foo'      # rev 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   176
  $ hg tag bar              # rev 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   177
  $ echo >> foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   178
  $ hg ci -m 'change foo 1' # rev 2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   179
  $ hg up -C 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   180
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   181
  $ hg tag -r 1 -f bar      # rev 3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   182
  $ hg up -C 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   183
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   184
  $ echo >> foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   185
  $ hg ci -m 'change foo 2' # rev 4
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   186
  created new head
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   187
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   188
  tip                                4:0c192d7d5e6b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   189
  bar                                1:78391a272241
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
   190
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   191
Repeat in case of cache effects:
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
   192
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   193
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   194
  tip                                4:0c192d7d5e6b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   195
  bar                                1:78391a272241
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   196
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   197
Detailed dump of tag info:
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
   198
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   199
  $ hg heads -q             # expect 4, 3, 2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   200
  4:0c192d7d5e6b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   201
  3:6fa450212aeb
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   202
  2:7a94127795a3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   203
  $ dumptags 2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   204
  rev 2: .hgtags:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   205
  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   206
  $ dumptags 3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   207
  rev 3: .hgtags:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   208
  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   209
  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   210
  78391a272241d70354aa14c874552cad6b51bb42 bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   211
  $ dumptags 4
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   212
  rev 4: .hgtags:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   213
  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   214
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   215
Dump cache:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   216
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
   217
  $ cat .hg/cache/tags
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   218
  4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   219
  3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   220
  2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   221
  
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   222
  78391a272241d70354aa14c874552cad6b51bb42 bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   223
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   224
Test tag removal:
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   225
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   226
  $ hg tag --remove bar     # rev 5
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   227
  $ hg tip -vp
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   228
  changeset:   5:5f6e8655b1c7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   229
  tag:         tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   230
  user:        test
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   231
  date:        Thu Jan 01 00:00:00 1970 +0000
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   232
  files:       .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   233
  description:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   234
  Removed tag bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   235
  
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   236
  
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   237
  diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   238
  --- a/.hgtags	Thu Jan 01 00:00:00 1970 +0000
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   239
  +++ b/.hgtags	Thu Jan 01 00:00:00 1970 +0000
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   240
  @@ -1,1 +1,3 @@
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   241
   bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   242
  +78391a272241d70354aa14c874552cad6b51bb42 bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   243
  +0000000000000000000000000000000000000000 bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   244
  
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   245
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   246
  tip                                5:5f6e8655b1c7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   247
  $ hg tags                 # again, try to expose cache bugs
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   248
  tip                                5:5f6e8655b1c7
4213
3be4785f8994 tags: add --remove
Matt Mackall <mpm@selenic.com>
parents: 4211
diff changeset
   249
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   250
Remove nonexistent tag:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   251
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   252
  $ hg tag --remove foobar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   253
  abort: tag 'foobar' does not exist
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11744
diff changeset
   254
  [255]
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   255
  $ hg tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   256
  changeset:   5:5f6e8655b1c7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   257
  tag:         tip
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   258
  user:        test
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   259
  date:        Thu Jan 01 00:00:00 1970 +0000
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   260
  summary:     Removed tag bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   261
  
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
   262
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   263
Undo a tag with rollback:
4651
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
   264
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   265
  $ hg rollback             # destroy rev 5 (restore bar)
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13272
diff changeset
   266
  repository tip rolled back to revision 4 (undo commit)
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13272
diff changeset
   267
  working directory now based on revision 4
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   268
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   269
  tip                                4:0c192d7d5e6b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   270
  bar                                1:78391a272241
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   271
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   272
  tip                                4:0c192d7d5e6b
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   273
  bar                                1:78391a272241
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   274
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   275
Test tag rank:
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   276
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   277
  $ cd ..
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   278
  $ hg init t3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   279
  $ cd t3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   280
  $ echo foo > foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   281
  $ hg add foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   282
  $ hg ci -m 'add foo'       # rev 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   283
  $ hg tag -f bar            # rev 1 bar -> 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   284
  $ hg tag -f bar            # rev 2 bar -> 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   285
  $ hg tag -fr 0 bar         # rev 3 bar -> 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   286
  $ hg tag -fr 1 bar         # rev 4 bar -> 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   287
  $ hg tag -fr 0 bar         # rev 5 bar -> 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   288
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   289
  tip                                5:85f05169d91d
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   290
  bar                                0:bbd179dfa0a7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   291
  $ hg co 3
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   292
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   293
  $ echo barbar > foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   294
  $ hg ci -m 'change foo'    # rev 6
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   295
  created new head
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   296
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   297
  tip                                6:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   298
  bar                                0:bbd179dfa0a7
4267
8185a1ca8628 tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents: 4266
diff changeset
   299
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   300
Don't allow moving tag without -f:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   301
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   302
  $ hg tag -r 3 bar
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   303
  abort: tag 'bar' already exists (use -f to force)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11744
diff changeset
   304
  [255]
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   305
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   306
  tip                                6:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   307
  bar                                0:bbd179dfa0a7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   308
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   309
Strip 1: expose an old head:
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
   310
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   311
  $ hg --config extensions.mq= strip 5
12640
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12376
diff changeset
   312
  saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   313
  $ hg tags                  # partly stale cache
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   314
  tip                                5:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   315
  bar                                1:78391a272241
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   316
  $ hg tags                  # up-to-date cache
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   317
  tip                                5:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   318
  bar                                1:78391a272241
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   319
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   320
Strip 2: destroy whole branch, no old head exposed
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
   321
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   322
  $ hg --config extensions.mq= strip 4
12640
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12376
diff changeset
   323
  saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   324
  $ hg tags                  # partly stale
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   325
  tip                                4:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   326
  bar                                0:bbd179dfa0a7
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12763
diff changeset
   327
  $ rm -f .hg/cache/tags
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   328
  $ hg tags                  # cold cache
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   329
  tip                                4:735c3ca72986
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   330
  bar                                0:bbd179dfa0a7
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   331
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   332
Test tag rank with 3 heads:
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   333
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   334
  $ cd ..
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   335
  $ hg init t4
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   336
  $ cd t4
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   337
  $ echo foo > foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   338
  $ hg add
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   339
  adding foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   340
  $ hg ci -m 'add foo'                 # rev 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   341
  $ hg tag bar                         # rev 1 bar -> 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   342
  $ hg tag -f bar                      # rev 2 bar -> 1
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   343
  $ hg up -qC 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   344
  $ hg tag -fr 2 bar                   # rev 3 bar -> 2
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   345
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   346
  tip                                3:197c21bbbf2c
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   347
  bar                                2:6fa450212aeb
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   348
  $ hg up -qC 0
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   349
  $ hg tag -m 'retag rev 0' -fr 0 bar  # rev 4 bar -> 0, but bar stays at 2
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   350
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   351
Bar should still point to rev 2:
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   352
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   353
  $ hg tags
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   354
  tip                                4:3b4b14ed0202
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   355
  bar                                2:6fa450212aeb
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   356
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   357
Test that removing global/local tags does not get confused when trying
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   358
to remove a tag of type X which actually only exists as a type Y:
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   359
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   360
  $ cd ..
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   361
  $ hg init t5
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   362
  $ cd t5
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   363
  $ echo foo > foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   364
  $ hg add
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   365
  adding foo
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   366
  $ hg ci -m 'add foo'                 # rev 0
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
   367
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   368
  $ hg tag -r 0 -l localtag
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   369
  $ hg tag --remove localtag
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   370
  abort: tag 'localtag' is not a global tag
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11744
diff changeset
   371
  [255]
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   372
  $ 
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   373
  $ hg tag -r 0 globaltag
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   374
  $ hg tag --remove -l globaltag
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   375
  abort: tag 'globaltag' is not a local tag
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11744
diff changeset
   376
  [255]
11744
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   377
  $ hg tags -v
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   378
  tip                                1:a0b6fe111088
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   379
  localtag                           0:bbd179dfa0a7 local
5b53aa2d4b99 tests: unify test-tags
Matt Mackall <mpm@selenic.com>
parents: 9366
diff changeset
   380
  globaltag                          0:bbd179dfa0a7