##// END OF EJS Templates
tests: mock getpid to reduce glob usage...
timeless -
r28242:e8ad56d9 default
parent child Browse files
Show More
@@ -1,186 +1,186 b''
1 1 setup
2 2 $ cat >> $HGRCPATH <<EOF
3 3 > [extensions]
4 4 > blackbox=
5 5 > mock=$TESTDIR/mockblackbox.py
6 6 > mq=
7 7 > EOF
8 8 $ hg init blackboxtest
9 9 $ cd blackboxtest
10 10
11 11 command, exit codes, and duration
12 12
13 13 $ echo a > a
14 14 $ hg add a
15 15 $ hg blackbox
16 1970/01/01 00:00:00 bob (*)> add a (glob)
17 1970/01/01 00:00:00 bob (*)> add a exited 0 after * seconds (glob)
18 1970/01/01 00:00:00 bob (*)> blackbox (glob)
16 1970/01/01 00:00:00 bob (5000)> add a
17 1970/01/01 00:00:00 bob (5000)> add a exited 0 after * seconds (glob)
18 1970/01/01 00:00:00 bob (5000)> blackbox
19 19
20 20 incoming change tracking
21 21
22 22 create two heads to verify that we only see one change in the log later
23 23 $ hg commit -ma
24 24 $ hg up null
25 25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 26 $ echo b > b
27 27 $ hg commit -Amb
28 28 adding b
29 29 created new head
30 30
31 31 clone, commit, pull
32 32 $ hg clone . ../blackboxtest2
33 33 updating to branch default
34 34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 35 $ echo c > c
36 36 $ hg commit -Amc
37 37 adding c
38 38 $ cd ../blackboxtest2
39 39 $ hg pull
40 40 pulling from $TESTTMP/blackboxtest (glob)
41 41 searching for changes
42 42 adding changesets
43 43 adding manifests
44 44 adding file changes
45 45 added 1 changesets with 1 changes to 1 files
46 46 (run 'hg update' to get a working copy)
47 47 $ hg blackbox -l 6
48 1970/01/01 00:00:00 bob (*)> pull (glob)
49 1970/01/01 00:00:00 bob (*)> updated served branch cache in * seconds (glob)
50 1970/01/01 00:00:00 bob (*)> wrote served branch cache with 1 labels and 2 nodes (glob)
51 1970/01/01 00:00:00 bob (*)> 1 incoming changes - new heads: d02f48003e62 (glob)
52 1970/01/01 00:00:00 bob (*)> pull exited 0 after * seconds (glob)
53 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
48 1970/01/01 00:00:00 bob (5000)> pull
49 1970/01/01 00:00:00 bob (5000)> updated served branch cache in * seconds (glob)
50 1970/01/01 00:00:00 bob (5000)> wrote served branch cache with 1 labels and 2 nodes
51 1970/01/01 00:00:00 bob (5000)> 1 incoming changes - new heads: d02f48003e62
52 1970/01/01 00:00:00 bob (5000)> pull exited 0 after * seconds (glob)
53 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
54 54
55 55 we must not cause a failure if we cannot write to the log
56 56
57 57 $ hg rollback
58 58 repository tip rolled back to revision 1 (undo pull)
59 59
60 60 $ mv .hg/blackbox.log .hg/blackbox.log-
61 61 $ mkdir .hg/blackbox.log
62 62 $ hg --debug incoming
63 63 warning: cannot write to blackbox.log: * (glob)
64 64 comparing with $TESTTMP/blackboxtest (glob)
65 65 query 1; heads
66 66 searching for changes
67 67 all local heads known remotely
68 68 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
69 69 tag: tip
70 70 phase: draft
71 71 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
72 72 parent: -1:0000000000000000000000000000000000000000
73 73 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
74 74 user: test
75 75 date: Thu Jan 01 00:00:00 1970 +0000
76 76 files+: c
77 77 extra: branch=default
78 78 description:
79 79 c
80 80
81 81
82 82 $ hg pull
83 83 pulling from $TESTTMP/blackboxtest (glob)
84 84 searching for changes
85 85 adding changesets
86 86 adding manifests
87 87 adding file changes
88 88 added 1 changesets with 1 changes to 1 files
89 89 (run 'hg update' to get a working copy)
90 90
91 91 a failure reading from the log is fatal
92 92
93 93 $ hg blackbox -l 3
94 94 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
95 95 [255]
96 96
97 97 $ rmdir .hg/blackbox.log
98 98 $ mv .hg/blackbox.log- .hg/blackbox.log
99 99
100 100 backup bundles get logged
101 101
102 102 $ touch d
103 103 $ hg commit -Amd
104 104 adding d
105 105 created new head
106 106 $ hg strip tip
107 107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
108 108 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
109 109 $ hg blackbox -l 6
110 1970/01/01 00:00:00 bob (*)> strip tip (glob)
111 1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob)
112 1970/01/01 00:00:00 bob (*)> updated base branch cache in * seconds (glob)
113 1970/01/01 00:00:00 bob (*)> wrote base branch cache with 1 labels and 2 nodes (glob)
114 1970/01/01 00:00:00 bob (*)> strip tip exited 0 after * seconds (glob)
115 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
110 1970/01/01 00:00:00 bob (5000)> strip tip
111 1970/01/01 00:00:00 bob (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob)
112 1970/01/01 00:00:00 bob (5000)> updated base branch cache in * seconds (glob)
113 1970/01/01 00:00:00 bob (5000)> wrote base branch cache with 1 labels and 2 nodes
114 1970/01/01 00:00:00 bob (5000)> strip tip exited 0 after * seconds (glob)
115 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
116 116
117 117 extension and python hooks - use the eol extension for a pythonhook
118 118
119 119 $ echo '[extensions]' >> .hg/hgrc
120 120 $ echo 'eol=' >> .hg/hgrc
121 121 $ echo '[hooks]' >> .hg/hgrc
122 122 $ echo 'update = echo hooked' >> .hg/hgrc
123 123 $ hg update
124 124 hooked
125 125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 126 1 other heads for branch "default"
127 127 $ hg blackbox -l 6
128 1970/01/01 00:00:00 bob (*)> update (glob)
129 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 0 tags (glob)
130 1970/01/01 00:00:00 bob (*)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
131 1970/01/01 00:00:00 bob (*)> exthook-update: echo hooked finished in * seconds (glob)
132 1970/01/01 00:00:00 bob (*)> update exited 0 after * seconds (glob)
133 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
128 1970/01/01 00:00:00 bob (5000)> update
129 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 0 tags
130 1970/01/01 00:00:00 bob (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
131 1970/01/01 00:00:00 bob (5000)> exthook-update: echo hooked finished in * seconds (glob)
132 1970/01/01 00:00:00 bob (5000)> update exited 0 after * seconds (glob)
133 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
134 134
135 135 log rotation
136 136
137 137 $ echo '[blackbox]' >> .hg/hgrc
138 138 $ echo 'maxsize = 20 b' >> .hg/hgrc
139 139 $ echo 'maxfiles = 3' >> .hg/hgrc
140 140 $ hg status
141 141 $ hg status
142 142 $ hg status
143 143 $ hg tip -q
144 144 2:d02f48003e62
145 145 $ ls .hg/blackbox.log*
146 146 .hg/blackbox.log
147 147 .hg/blackbox.log.1
148 148 .hg/blackbox.log.2
149 149 $ cd ..
150 150
151 151 $ hg init blackboxtest3
152 152 $ cd blackboxtest3
153 153 $ hg blackbox
154 1970/01/01 00:00:00 bob (*)> blackbox (glob)
154 1970/01/01 00:00:00 bob (5000)> blackbox
155 155 $ mv .hg/blackbox.log .hg/blackbox.log-
156 156 $ mkdir .hg/blackbox.log
157 157 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
158 158 $ python ../test-dispatch.py
159 159 running: add foo
160 160 result: 0
161 161 running: commit -m commit1 -d 2000-01-01 foo
162 162 result: None
163 163 running: commit -m commit2 -d 2000-01-02 foo
164 164 result: None
165 165 running: log -r 0
166 166 changeset: 0:0e4634943879
167 167 user: test
168 168 date: Sat Jan 01 00:00:00 2000 +0000
169 169 summary: commit1
170 170
171 171 result: None
172 172 running: log -r tip
173 173 changeset: 1:45589e459b2e
174 174 tag: tip
175 175 user: test
176 176 date: Sun Jan 02 00:00:00 2000 +0000
177 177 summary: commit2
178 178
179 179 result: None
180 180 $ hg blackbox
181 1970/01/01 00:00:00 bob (*)> blackbox (glob)
182 1970/01/01 00:00:00 bob (*)> blackbox exited 0 after * seconds (glob)
183 1970/01/01 00:00:00 bob (*)> blackbox (glob)
181 1970/01/01 00:00:00 bob (5000)> blackbox
182 1970/01/01 00:00:00 bob (5000)> blackbox exited 0 after * seconds (glob)
183 1970/01/01 00:00:00 bob (5000)> blackbox
184 184
185 185 cleanup
186 186 $ cd ..
@@ -1,116 +1,116 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [extensions]
3 3 > blackbox=
4 4 > rebase=
5 5 > mock=$TESTDIR/mockblackbox.py
6 6 >
7 7 > [experimental]
8 8 > evolution = createmarkers
9 9 > EOF
10 10
11 11 Create a repo with some tags
12 12
13 13 $ hg init repo
14 14 $ cd repo
15 15 $ echo initial > foo
16 16 $ hg -q commit -A -m initial
17 17 $ hg tag -m 'test tag' test1
18 18 $ echo first > first
19 19 $ hg -q commit -A -m first
20 20 $ hg tag -m 'test2 tag' test2
21 21 $ hg -q up -r 0
22 22 $ echo newhead > newhead
23 23 $ hg commit -A -m newhead
24 24 adding newhead
25 25 created new head
26 26 $ hg tag -m 'test head 2 tag' head2
27 27
28 28 $ hg log -G -T '{rev}:{node|short} {tags} {desc}\n'
29 29 @ 5:2942a772f72a tip test head 2 tag
30 30 |
31 31 o 4:042eb6bfcc49 head2 newhead
32 32 |
33 33 | o 3:c3cb30f2d2cd test2 tag
34 34 | |
35 35 | o 2:d75775ffbc6b test2 first
36 36 | |
37 37 | o 1:5f97d42da03f test tag
38 38 |/
39 39 o 0:55482a6fb4b1 test1 initial
40 40
41 41
42 42 Trigger tags cache population by doing something that accesses tags info
43 43
44 44 $ hg tags
45 45 tip 5:2942a772f72a
46 46 head2 4:042eb6bfcc49
47 47 test2 2:d75775ffbc6b
48 48 test1 0:55482a6fb4b1
49 49
50 50 $ cat .hg/cache/tags2-visible
51 51 5 2942a772f72a444bef4bef13874d515f50fa27b6
52 52 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
53 53 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
54 54 d75775ffbc6bca1794d300f5571272879bd280da test2
55 55
56 56 Hiding a non-tip changeset should change filtered hash and cause tags recompute
57 57
58 58 $ hg debugobsolete -d '0 0' c3cb30f2d2cd0aae008cc91a07876e3c5131fd22 -u dummyuser
59 59
60 60 $ hg tags
61 61 tip 5:2942a772f72a
62 62 head2 4:042eb6bfcc49
63 63 test1 0:55482a6fb4b1
64 64
65 65 $ cat .hg/cache/tags2-visible
66 66 5 2942a772f72a444bef4bef13874d515f50fa27b6 f34fbc9a9769ba9eff5aff3d008a6b49f85c08b1
67 67 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
68 68 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
69 69
70 70 $ hg blackbox -l 5
71 1970/01/01 00:00:00 bob (*)> tags (glob)
72 1970/01/01 00:00:00 bob (*)> 2/2 cache hits/lookups in * seconds (glob)
73 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 2 tags (glob)
74 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
75 1970/01/01 00:00:00 bob (*)> blackbox -l 5 (glob)
71 1970/01/01 00:00:00 bob (5000)> tags
72 1970/01/01 00:00:00 bob (5000)> 2/2 cache hits/lookups in * seconds (glob)
73 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 2 tags
74 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
75 1970/01/01 00:00:00 bob (5000)> blackbox -l 5
76 76
77 77 Hiding another changeset should cause the filtered hash to change
78 78
79 79 $ hg debugobsolete -d '0 0' d75775ffbc6bca1794d300f5571272879bd280da -u dummyuser
80 80 $ hg debugobsolete -d '0 0' 5f97d42da03fd56f3b228b03dfe48af5c0adf75b -u dummyuser
81 81
82 82 $ hg tags
83 83 tip 5:2942a772f72a
84 84 head2 4:042eb6bfcc49
85 85
86 86 $ cat .hg/cache/tags2-visible
87 87 5 2942a772f72a444bef4bef13874d515f50fa27b6 2fce1eec33263d08a4d04293960fc73a555230e4
88 88 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
89 89
90 90 $ hg blackbox -l 5
91 1970/01/01 00:00:00 bob (*)> tags (glob)
92 1970/01/01 00:00:00 bob (*)> 1/1 cache hits/lookups in * seconds (glob)
93 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
94 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
95 1970/01/01 00:00:00 bob (*)> blackbox -l 5 (glob)
91 1970/01/01 00:00:00 bob (5000)> tags
92 1970/01/01 00:00:00 bob (5000)> 1/1 cache hits/lookups in * seconds (glob)
93 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
94 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
95 1970/01/01 00:00:00 bob (5000)> blackbox -l 5
96 96
97 97 Resolving tags on an unfiltered repo writes a separate tags cache
98 98
99 99 $ hg --hidden tags
100 100 tip 5:2942a772f72a
101 101 head2 4:042eb6bfcc49
102 102 test2 2:d75775ffbc6b
103 103 test1 0:55482a6fb4b1
104 104
105 105 $ cat .hg/cache/tags2
106 106 5 2942a772f72a444bef4bef13874d515f50fa27b6
107 107 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
108 108 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
109 109 d75775ffbc6bca1794d300f5571272879bd280da test2
110 110
111 111 $ hg blackbox -l 5
112 1970/01/01 00:00:00 bob (*)> --hidden tags (glob)
113 1970/01/01 00:00:00 bob (*)> 2/2 cache hits/lookups in * seconds (glob)
114 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2 with 3 tags (glob)
115 1970/01/01 00:00:00 bob (*)> --hidden tags exited 0 after * seconds (glob)
116 1970/01/01 00:00:00 bob (*)> blackbox -l 5 (glob)
112 1970/01/01 00:00:00 bob (5000)> --hidden tags
113 1970/01/01 00:00:00 bob (5000)> 2/2 cache hits/lookups in * seconds (glob)
114 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2 with 3 tags
115 1970/01/01 00:00:00 bob (5000)> --hidden tags exited 0 after * seconds (glob)
116 1970/01/01 00:00:00 bob (5000)> blackbox -l 5
@@ -1,712 +1,712 b''
1 1 setup
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [extensions]
5 5 > blackbox=
6 6 > mock=$TESTDIR/mockblackbox.py
7 7 > EOF
8 8
9 9 Helper functions:
10 10
11 11 $ cacheexists() {
12 12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
13 13 > }
14 14
15 15 $ fnodescacheexists() {
16 16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
17 17 > }
18 18
19 19 $ dumptags() {
20 20 > rev=$1
21 21 > echo "rev $rev: .hgtags:"
22 22 > hg cat -r$rev .hgtags
23 23 > }
24 24
25 25 # XXX need to test that the tag cache works when we strip an old head
26 26 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
27 27 # same, but stuff has changed behind tip.
28 28
29 29 Setup:
30 30
31 31 $ hg init t
32 32 $ cd t
33 33 $ cacheexists
34 34 no tag cache
35 35 $ fnodescacheexists
36 36 no fnodes cache
37 37 $ hg id
38 38 000000000000 tip
39 39 $ cacheexists
40 40 no tag cache
41 41 $ fnodescacheexists
42 42 no fnodes cache
43 43 $ echo a > a
44 44 $ hg add a
45 45 $ hg commit -m "test"
46 46 $ hg co
47 47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 48 $ hg identify
49 49 acb14030fe0a tip
50 50 $ hg identify -r 'wdir()'
51 51 acb14030fe0a tip
52 52 $ cacheexists
53 53 tag cache exists
54 54 No fnodes cache because .hgtags file doesn't exist
55 55 (this is an implementation detail)
56 56 $ fnodescacheexists
57 57 no fnodes cache
58 58
59 59 Try corrupting the cache
60 60
61 61 $ printf 'a b' > .hg/cache/tags2-visible
62 62 $ hg identify
63 63 acb14030fe0a tip
64 64 $ cacheexists
65 65 tag cache exists
66 66 $ fnodescacheexists
67 67 no fnodes cache
68 68 $ hg identify
69 69 acb14030fe0a tip
70 70
71 71 Create local tag with long name:
72 72
73 73 $ T=`hg identify --debug --id`
74 74 $ hg tag -l "This is a local tag with a really long name!"
75 75 $ hg tags
76 76 tip 0:acb14030fe0a
77 77 This is a local tag with a really long name! 0:acb14030fe0a
78 78 $ rm .hg/localtags
79 79
80 80 Create a tag behind hg's back:
81 81
82 82 $ echo "$T first" > .hgtags
83 83 $ cat .hgtags
84 84 acb14030fe0a21b60322c440ad2d20cf7685a376 first
85 85 $ hg add .hgtags
86 86 $ hg commit -m "add tags"
87 87 $ hg tags
88 88 tip 1:b9154636be93
89 89 first 0:acb14030fe0a
90 90 $ hg identify
91 91 b9154636be93 tip
92 92
93 93 We should have a fnodes cache now that we have a real tag
94 94 The cache should have an empty entry for rev 0 and a valid entry for rev 1.
95 95
96 96
97 97 $ fnodescacheexists
98 98 fnodes cache exists
99 99 $ f --size --hexdump .hg/cache/hgtagsfnodes1
100 100 .hg/cache/hgtagsfnodes1: size=48
101 101 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
102 102 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
103 103 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
104 104
105 105 Repeat with cold tag cache:
106 106
107 107 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
108 108 $ hg identify
109 109 b9154636be93 tip
110 110
111 111 $ fnodescacheexists
112 112 fnodes cache exists
113 113 $ f --size --hexdump .hg/cache/hgtagsfnodes1
114 114 .hg/cache/hgtagsfnodes1: size=48
115 115 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
116 116 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
117 117 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
118 118
119 119 And again, but now unable to write tag cache or lock file:
120 120
121 121 #if unix-permissions
122 122 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
123 123 $ chmod 555 .hg/cache
124 124 $ hg identify
125 125 b9154636be93 tip
126 126 $ chmod 755 .hg/cache
127 127
128 128 $ chmod 555 .hg
129 129 $ hg identify
130 130 b9154636be93 tip
131 131 $ chmod 755 .hg
132 132 #endif
133 133
134 134 Tag cache debug info written to blackbox log
135 135
136 136 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
137 137 $ hg identify
138 138 b9154636be93 tip
139 139 $ hg blackbox -l 6
140 1970/01/01 00:00:00 bob (*)> identify (glob)
141 1970/01/01 00:00:00 bob (*)> writing 48 bytes to cache/hgtagsfnodes1 (glob)
142 1970/01/01 00:00:00 bob (*)> 0/1 cache hits/lookups in * seconds (glob)
143 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
144 1970/01/01 00:00:00 bob (*)> identify exited 0 after * seconds (glob)
145 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
140 1970/01/01 00:00:00 bob (5000)> identify
141 1970/01/01 00:00:00 bob (5000)> writing 48 bytes to cache/hgtagsfnodes1
142 1970/01/01 00:00:00 bob (5000)> 0/1 cache hits/lookups in * seconds (glob)
143 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
144 1970/01/01 00:00:00 bob (5000)> identify exited 0 after * seconds (glob)
145 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
146 146
147 147 Failure to acquire lock results in no write
148 148
149 149 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
150 150 $ echo 'foo:1' > .hg/wlock
151 151 $ hg identify
152 152 b9154636be93 tip
153 153 $ hg blackbox -l 6
154 1970/01/01 00:00:00 bob (*)> identify (glob)
155 1970/01/01 00:00:00 bob (*)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired (glob)
156 1970/01/01 00:00:00 bob (*)> 0/1 cache hits/lookups in * seconds (glob)
157 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
158 1970/01/01 00:00:00 bob (*)> identify exited 0 after * seconds (glob)
159 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
154 1970/01/01 00:00:00 bob (5000)> identify
155 1970/01/01 00:00:00 bob (5000)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired
156 1970/01/01 00:00:00 bob (5000)> 0/1 cache hits/lookups in * seconds (glob)
157 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
158 1970/01/01 00:00:00 bob (5000)> identify exited 0 after * seconds (glob)
159 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
160 160
161 161 $ fnodescacheexists
162 162 no fnodes cache
163 163
164 164 $ rm .hg/wlock
165 165
166 166 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
167 167 $ hg identify
168 168 b9154636be93 tip
169 169
170 170 Create a branch:
171 171
172 172 $ echo bb > a
173 173 $ hg status
174 174 M a
175 175 $ hg identify
176 176 b9154636be93+ tip
177 177 $ hg co first
178 178 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
179 179 $ hg id
180 180 acb14030fe0a+ first
181 181 $ hg id -r 'wdir()'
182 182 acb14030fe0a+ first
183 183 $ hg -v id
184 184 acb14030fe0a+ first
185 185 $ hg status
186 186 M a
187 187 $ echo 1 > b
188 188 $ hg add b
189 189 $ hg commit -m "branch"
190 190 created new head
191 191
192 192 Creating a new commit shouldn't append the .hgtags fnodes cache until
193 193 tags info is accessed
194 194
195 195 $ f --size --hexdump .hg/cache/hgtagsfnodes1
196 196 .hg/cache/hgtagsfnodes1: size=48
197 197 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
198 198 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
199 199 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
200 200
201 201 $ hg id
202 202 c8edf04160c7 tip
203 203
204 204 First 4 bytes of record 3 are changeset fragment
205 205
206 206 $ f --size --hexdump .hg/cache/hgtagsfnodes1
207 207 .hg/cache/hgtagsfnodes1: size=72
208 208 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
209 209 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
210 210 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
211 211 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............|
212 212 0040: 00 00 00 00 00 00 00 00 |........|
213 213
214 214 Merge the two heads:
215 215
216 216 $ hg merge 1
217 217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 218 (branch merge, don't forget to commit)
219 219 $ hg id
220 220 c8edf04160c7+b9154636be93+ tip
221 221 $ hg status
222 222 M .hgtags
223 223 $ hg commit -m "merge"
224 224
225 225 Create a fake head, make sure tag not visible afterwards:
226 226
227 227 $ cp .hgtags tags
228 228 $ hg tag last
229 229 $ hg rm .hgtags
230 230 $ hg commit -m "remove"
231 231
232 232 $ mv tags .hgtags
233 233 $ hg add .hgtags
234 234 $ hg commit -m "readd"
235 235 $
236 236 $ hg tags
237 237 tip 6:35ff301afafe
238 238 first 0:acb14030fe0a
239 239
240 240 Add invalid tags:
241 241
242 242 $ echo "spam" >> .hgtags
243 243 $ echo >> .hgtags
244 244 $ echo "foo bar" >> .hgtags
245 245 $ echo "a5a5 invalid" >> .hg/localtags
246 246 $ cat .hgtags
247 247 acb14030fe0a21b60322c440ad2d20cf7685a376 first
248 248 spam
249 249
250 250 foo bar
251 251 $ hg commit -m "tags"
252 252
253 253 Report tag parse error on other head:
254 254
255 255 $ hg up 3
256 256 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 257 $ echo 'x y' >> .hgtags
258 258 $ hg commit -m "head"
259 259 created new head
260 260
261 261 $ hg tags
262 262 .hgtags@75d9f02dfe28, line 2: cannot parse entry
263 263 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
264 264 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
265 265 tip 8:c4be69a18c11
266 266 first 0:acb14030fe0a
267 267 $ hg tip
268 268 changeset: 8:c4be69a18c11
269 269 tag: tip
270 270 parent: 3:ac5e980c4dc0
271 271 user: test
272 272 date: Thu Jan 01 00:00:00 1970 +0000
273 273 summary: head
274 274
275 275
276 276 Test tag precedence rules:
277 277
278 278 $ cd ..
279 279 $ hg init t2
280 280 $ cd t2
281 281 $ echo foo > foo
282 282 $ hg add foo
283 283 $ hg ci -m 'add foo' # rev 0
284 284 $ hg tag bar # rev 1
285 285 $ echo >> foo
286 286 $ hg ci -m 'change foo 1' # rev 2
287 287 $ hg up -C 1
288 288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 289 $ hg tag -r 1 -f bar # rev 3
290 290 $ hg up -C 1
291 291 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 292 $ echo >> foo
293 293 $ hg ci -m 'change foo 2' # rev 4
294 294 created new head
295 295 $ hg tags
296 296 tip 4:0c192d7d5e6b
297 297 bar 1:78391a272241
298 298
299 299 Repeat in case of cache effects:
300 300
301 301 $ hg tags
302 302 tip 4:0c192d7d5e6b
303 303 bar 1:78391a272241
304 304
305 305 Detailed dump of tag info:
306 306
307 307 $ hg heads -q # expect 4, 3, 2
308 308 4:0c192d7d5e6b
309 309 3:6fa450212aeb
310 310 2:7a94127795a3
311 311 $ dumptags 2
312 312 rev 2: .hgtags:
313 313 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
314 314 $ dumptags 3
315 315 rev 3: .hgtags:
316 316 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
317 317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
318 318 78391a272241d70354aa14c874552cad6b51bb42 bar
319 319 $ dumptags 4
320 320 rev 4: .hgtags:
321 321 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
322 322
323 323 Dump cache:
324 324
325 325 $ cat .hg/cache/tags2-visible
326 326 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
327 327 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
328 328 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
329 329 78391a272241d70354aa14c874552cad6b51bb42 bar
330 330
331 331 $ f --size --hexdump .hg/cache/hgtagsfnodes1
332 332 .hg/cache/hgtagsfnodes1: size=120
333 333 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
334 334 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
335 335 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
336 336 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
337 337 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
338 338 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
339 339 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
340 340 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=|
341 341
342 342 Corrupt the .hgtags fnodes cache
343 343 Extra junk data at the end should get overwritten on next cache update
344 344
345 345 $ echo extra >> .hg/cache/hgtagsfnodes1
346 346 $ echo dummy1 > foo
347 347 $ hg commit -m throwaway1
348 348
349 349 $ hg tags
350 350 tip 5:8dbfe60eff30
351 351 bar 1:78391a272241
352 352
353 353 $ hg blackbox -l 6
354 1970/01/01 00:00:00 bob (*)> tags (glob)
355 1970/01/01 00:00:00 bob (*)> writing 24 bytes to cache/hgtagsfnodes1 (glob)
356 1970/01/01 00:00:00 bob (*)> 2/3 cache hits/lookups in * seconds (glob)
357 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
358 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
359 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
354 1970/01/01 00:00:00 bob (5000)> tags
355 1970/01/01 00:00:00 bob (5000)> writing 24 bytes to cache/hgtagsfnodes1
356 1970/01/01 00:00:00 bob (5000)> 2/3 cache hits/lookups in * seconds (glob)
357 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
358 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
359 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
360 360
361 361 #if unix-permissions no-root
362 362 Errors writing to .hgtags fnodes cache are silently ignored
363 363
364 364 $ echo dummy2 > foo
365 365 $ hg commit -m throwaway2
366 366
367 367 $ chmod a-w .hg/cache/hgtagsfnodes1
368 368 $ rm -f .hg/cache/tags2-visible
369 369
370 370 $ hg tags
371 371 tip 6:b968051b5cf3
372 372 bar 1:78391a272241
373 373
374 374 $ hg blackbox -l 6
375 1970/01/01 00:00:00 bob (*)> tags (glob)
376 1970/01/01 00:00:00 bob (*)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1' (glob)
377 1970/01/01 00:00:00 bob (*)> 2/3 cache hits/lookups in * seconds (glob)
378 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
379 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
380 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
375 1970/01/01 00:00:00 bob (5000)> tags
376 1970/01/01 00:00:00 bob (5000)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1' (glob)
377 1970/01/01 00:00:00 bob (5000)> 2/3 cache hits/lookups in * seconds (glob)
378 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
379 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
380 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
381 381
382 382 $ chmod a+w .hg/cache/hgtagsfnodes1
383 383
384 384 $ rm -f .hg/cache/tags2-visible
385 385 $ hg tags
386 386 tip 6:b968051b5cf3
387 387 bar 1:78391a272241
388 388
389 389 $ hg blackbox -l 6
390 1970/01/01 00:00:00 bob (*)> tags (glob)
391 1970/01/01 00:00:00 bob (*)> writing 24 bytes to cache/hgtagsfnodes1 (glob)
392 1970/01/01 00:00:00 bob (*)> 2/3 cache hits/lookups in * seconds (glob)
393 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
394 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
395 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
390 1970/01/01 00:00:00 bob (5000)> tags
391 1970/01/01 00:00:00 bob (5000)> writing 24 bytes to cache/hgtagsfnodes1
392 1970/01/01 00:00:00 bob (5000)> 2/3 cache hits/lookups in * seconds (glob)
393 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
394 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
395 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
396 396
397 397 $ f --size .hg/cache/hgtagsfnodes1
398 398 .hg/cache/hgtagsfnodes1: size=168
399 399
400 400 $ hg -q --config extensions.strip= strip -r 6 --no-backup
401 401 #endif
402 402
403 403 Stripping doesn't truncate the tags cache until new data is available
404 404
405 405 $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible
406 406 $ hg tags
407 407 tip 5:8dbfe60eff30
408 408 bar 1:78391a272241
409 409
410 410 $ f --size .hg/cache/hgtagsfnodes1
411 411 .hg/cache/hgtagsfnodes1: size=144
412 412
413 413 $ hg -q --config extensions.strip= strip -r 5 --no-backup
414 414 $ hg tags
415 415 tip 4:0c192d7d5e6b
416 416 bar 1:78391a272241
417 417
418 418 $ hg blackbox -l 5
419 1970/01/01 00:00:00 bob (*)> writing 24 bytes to cache/hgtagsfnodes1 (glob)
420 1970/01/01 00:00:00 bob (*)> 2/3 cache hits/lookups in * seconds (glob)
421 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
422 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
423 1970/01/01 00:00:00 bob (*)> blackbox -l 5 (glob)
419 1970/01/01 00:00:00 bob (5000)> writing 24 bytes to cache/hgtagsfnodes1
420 1970/01/01 00:00:00 bob (5000)> 2/3 cache hits/lookups in * seconds (glob)
421 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
422 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
423 1970/01/01 00:00:00 bob (5000)> blackbox -l 5
424 424
425 425 $ f --size .hg/cache/hgtagsfnodes1
426 426 .hg/cache/hgtagsfnodes1: size=120
427 427
428 428 $ echo dummy > foo
429 429 $ hg commit -m throwaway3
430 430
431 431 $ hg tags
432 432 tip 5:035f65efb448
433 433 bar 1:78391a272241
434 434
435 435 $ hg blackbox -l 6
436 1970/01/01 00:00:00 bob (*)> tags (glob)
437 1970/01/01 00:00:00 bob (*)> writing 24 bytes to cache/hgtagsfnodes1 (glob)
438 1970/01/01 00:00:00 bob (*)> 2/3 cache hits/lookups in * seconds (glob)
439 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 1 tags (glob)
440 1970/01/01 00:00:00 bob (*)> tags exited 0 after * seconds (glob)
441 1970/01/01 00:00:00 bob (*)> blackbox -l 6 (glob)
436 1970/01/01 00:00:00 bob (5000)> tags
437 1970/01/01 00:00:00 bob (5000)> writing 24 bytes to cache/hgtagsfnodes1
438 1970/01/01 00:00:00 bob (5000)> 2/3 cache hits/lookups in * seconds (glob)
439 1970/01/01 00:00:00 bob (5000)> writing .hg/cache/tags2-visible with 1 tags
440 1970/01/01 00:00:00 bob (5000)> tags exited 0 after * seconds (glob)
441 1970/01/01 00:00:00 bob (5000)> blackbox -l 6
442 442 $ f --size .hg/cache/hgtagsfnodes1
443 443 .hg/cache/hgtagsfnodes1: size=144
444 444
445 445 $ hg -q --config extensions.strip= strip -r 5 --no-backup
446 446
447 447 Test tag removal:
448 448
449 449 $ hg tag --remove bar # rev 5
450 450 $ hg tip -vp
451 451 changeset: 5:5f6e8655b1c7
452 452 tag: tip
453 453 user: test
454 454 date: Thu Jan 01 00:00:00 1970 +0000
455 455 files: .hgtags
456 456 description:
457 457 Removed tag bar
458 458
459 459
460 460 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
461 461 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
462 462 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
463 463 @@ -1,1 +1,3 @@
464 464 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
465 465 +78391a272241d70354aa14c874552cad6b51bb42 bar
466 466 +0000000000000000000000000000000000000000 bar
467 467
468 468 $ hg tags
469 469 tip 5:5f6e8655b1c7
470 470 $ hg tags # again, try to expose cache bugs
471 471 tip 5:5f6e8655b1c7
472 472
473 473 Remove nonexistent tag:
474 474
475 475 $ hg tag --remove foobar
476 476 abort: tag 'foobar' does not exist
477 477 [255]
478 478 $ hg tip
479 479 changeset: 5:5f6e8655b1c7
480 480 tag: tip
481 481 user: test
482 482 date: Thu Jan 01 00:00:00 1970 +0000
483 483 summary: Removed tag bar
484 484
485 485
486 486 Undo a tag with rollback:
487 487
488 488 $ hg rollback # destroy rev 5 (restore bar)
489 489 repository tip rolled back to revision 4 (undo commit)
490 490 working directory now based on revision 4
491 491 $ hg tags
492 492 tip 4:0c192d7d5e6b
493 493 bar 1:78391a272241
494 494 $ hg tags
495 495 tip 4:0c192d7d5e6b
496 496 bar 1:78391a272241
497 497
498 498 Test tag rank:
499 499
500 500 $ cd ..
501 501 $ hg init t3
502 502 $ cd t3
503 503 $ echo foo > foo
504 504 $ hg add foo
505 505 $ hg ci -m 'add foo' # rev 0
506 506 $ hg tag -f bar # rev 1 bar -> 0
507 507 $ hg tag -f bar # rev 2 bar -> 1
508 508 $ hg tag -fr 0 bar # rev 3 bar -> 0
509 509 $ hg tag -fr 1 bar # rev 4 bar -> 1
510 510 $ hg tag -fr 0 bar # rev 5 bar -> 0
511 511 $ hg tags
512 512 tip 5:85f05169d91d
513 513 bar 0:bbd179dfa0a7
514 514 $ hg co 3
515 515 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
516 516 $ echo barbar > foo
517 517 $ hg ci -m 'change foo' # rev 6
518 518 created new head
519 519 $ hg tags
520 520 tip 6:735c3ca72986
521 521 bar 0:bbd179dfa0a7
522 522
523 523 Don't allow moving tag without -f:
524 524
525 525 $ hg tag -r 3 bar
526 526 abort: tag 'bar' already exists (use -f to force)
527 527 [255]
528 528 $ hg tags
529 529 tip 6:735c3ca72986
530 530 bar 0:bbd179dfa0a7
531 531
532 532 Strip 1: expose an old head:
533 533
534 534 $ hg --config extensions.mq= strip 5
535 535 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
536 536 $ hg tags # partly stale cache
537 537 tip 5:735c3ca72986
538 538 bar 1:78391a272241
539 539 $ hg tags # up-to-date cache
540 540 tip 5:735c3ca72986
541 541 bar 1:78391a272241
542 542
543 543 Strip 2: destroy whole branch, no old head exposed
544 544
545 545 $ hg --config extensions.mq= strip 4
546 546 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
547 547 $ hg tags # partly stale
548 548 tip 4:735c3ca72986
549 549 bar 0:bbd179dfa0a7
550 550 $ rm -f .hg/cache/tags2-visible
551 551 $ hg tags # cold cache
552 552 tip 4:735c3ca72986
553 553 bar 0:bbd179dfa0a7
554 554
555 555 Test tag rank with 3 heads:
556 556
557 557 $ cd ..
558 558 $ hg init t4
559 559 $ cd t4
560 560 $ echo foo > foo
561 561 $ hg add
562 562 adding foo
563 563 $ hg ci -m 'add foo' # rev 0
564 564 $ hg tag bar # rev 1 bar -> 0
565 565 $ hg tag -f bar # rev 2 bar -> 1
566 566 $ hg up -qC 0
567 567 $ hg tag -fr 2 bar # rev 3 bar -> 2
568 568 $ hg tags
569 569 tip 3:197c21bbbf2c
570 570 bar 2:6fa450212aeb
571 571 $ hg up -qC 0
572 572 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
573 573
574 574 Bar should still point to rev 2:
575 575
576 576 $ hg tags
577 577 tip 4:3b4b14ed0202
578 578 bar 2:6fa450212aeb
579 579
580 580 Test that removing global/local tags does not get confused when trying
581 581 to remove a tag of type X which actually only exists as a type Y:
582 582
583 583 $ cd ..
584 584 $ hg init t5
585 585 $ cd t5
586 586 $ echo foo > foo
587 587 $ hg add
588 588 adding foo
589 589 $ hg ci -m 'add foo' # rev 0
590 590
591 591 $ hg tag -r 0 -l localtag
592 592 $ hg tag --remove localtag
593 593 abort: tag 'localtag' is not a global tag
594 594 [255]
595 595 $
596 596 $ hg tag -r 0 globaltag
597 597 $ hg tag --remove -l globaltag
598 598 abort: tag 'globaltag' is not a local tag
599 599 [255]
600 600 $ hg tags -v
601 601 tip 1:a0b6fe111088
602 602 localtag 0:bbd179dfa0a7 local
603 603 globaltag 0:bbd179dfa0a7
604 604
605 605 Test for issue3911
606 606
607 607 $ hg tag -r 0 -l localtag2
608 608 $ hg tag -l --remove localtag2
609 609 $ hg tags -v
610 610 tip 1:a0b6fe111088
611 611 localtag 0:bbd179dfa0a7 local
612 612 globaltag 0:bbd179dfa0a7
613 613
614 614 $ hg tag -r 1 -f localtag
615 615 $ hg tags -v
616 616 tip 2:5c70a037bb37
617 617 localtag 1:a0b6fe111088
618 618 globaltag 0:bbd179dfa0a7
619 619
620 620 $ hg tags -v
621 621 tip 2:5c70a037bb37
622 622 localtag 1:a0b6fe111088
623 623 globaltag 0:bbd179dfa0a7
624 624
625 625 $ hg tag -r 1 localtag2
626 626 $ hg tags -v
627 627 tip 3:bbfb8cd42be2
628 628 localtag2 1:a0b6fe111088
629 629 localtag 1:a0b6fe111088
630 630 globaltag 0:bbd179dfa0a7
631 631
632 632 $ hg tags -v
633 633 tip 3:bbfb8cd42be2
634 634 localtag2 1:a0b6fe111088
635 635 localtag 1:a0b6fe111088
636 636 globaltag 0:bbd179dfa0a7
637 637
638 638 $ cd ..
639 639
640 640 Create a repository with tags data to test .hgtags fnodes transfer
641 641
642 642 $ hg init tagsserver
643 643 $ cd tagsserver
644 644 $ cat > .hg/hgrc << EOF
645 645 > [experimental]
646 646 > bundle2-exp=True
647 647 > EOF
648 648 $ touch foo
649 649 $ hg -q commit -A -m initial
650 650 $ hg tag -m 'tag 0.1' 0.1
651 651 $ echo second > foo
652 652 $ hg commit -m second
653 653 $ hg tag -m 'tag 0.2' 0.2
654 654 $ hg tags
655 655 tip 3:40f0358cb314
656 656 0.2 2:f63cc8fe54e4
657 657 0.1 0:96ee1d7354c4
658 658 $ cd ..
659 659
660 660 Cloning should pull down hgtags fnodes mappings and write the cache file
661 661
662 662 $ hg --config experimental.bundle2-exp=True clone --pull tagsserver tagsclient
663 663 requesting all changes
664 664 adding changesets
665 665 adding manifests
666 666 adding file changes
667 667 added 4 changesets with 4 changes to 2 files
668 668 updating to branch default
669 669 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
670 670
671 671 Missing tags2* files means the cache wasn't written through the normal mechanism.
672 672
673 673 $ ls tagsclient/.hg/cache
674 674 branch2-served
675 675 hgtagsfnodes1
676 676 rbc-names-v1
677 677 rbc-revs-v1
678 678
679 679 Cache should contain the head only, even though other nodes have tags data
680 680
681 681 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
682 682 tagsclient/.hg/cache/hgtagsfnodes1: size=96
683 683 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
684 684 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
685 685 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
686 686 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
687 687 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
688 688 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
689 689
690 690 Running hg tags should produce tags2* file and not change cache
691 691
692 692 $ hg -R tagsclient tags
693 693 tip 3:40f0358cb314
694 694 0.2 2:f63cc8fe54e4
695 695 0.1 0:96ee1d7354c4
696 696
697 697 $ ls tagsclient/.hg/cache
698 698 branch2-served
699 699 hgtagsfnodes1
700 700 rbc-names-v1
701 701 rbc-revs-v1
702 702 tags2-visible
703 703
704 704 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
705 705 tagsclient/.hg/cache/hgtagsfnodes1: size=96
706 706 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
707 707 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
708 708 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
709 709 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
710 710 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
711 711 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
712 712
General Comments 0
You need to be logged in to leave comments. Login now