##// END OF EJS Templates
test-tag: test that all reserved names are rejected
Kevin Bullock -
r17813:813db1dc default
parent child Browse files
Show More
@@ -1,319 +1,325 b''
1 1 $ hg init test
2 2 $ cd test
3 3
4 4 $ echo a > a
5 5 $ hg add a
6 6 $ hg commit -m "test"
7 7 $ hg history
8 8 changeset: 0:acb14030fe0a
9 9 tag: tip
10 10 user: test
11 11 date: Thu Jan 01 00:00:00 1970 +0000
12 12 summary: test
13 13
14 14
15 15 $ hg tag ' '
16 16 abort: tag names cannot consist entirely of whitespace
17 17 [255]
18 18
19 19 $ hg tag "bleah"
20 20 $ hg history
21 21 changeset: 1:d4f0d2909abc
22 22 tag: tip
23 23 user: test
24 24 date: Thu Jan 01 00:00:00 1970 +0000
25 25 summary: Added tag bleah for changeset acb14030fe0a
26 26
27 27 changeset: 0:acb14030fe0a
28 28 tag: bleah
29 29 user: test
30 30 date: Thu Jan 01 00:00:00 1970 +0000
31 31 summary: test
32 32
33 33
34 34 $ echo foo >> .hgtags
35 35 $ hg tag "bleah2"
36 36 abort: working copy of .hgtags is changed (please commit .hgtags manually)
37 37 [255]
38 38
39 39 $ hg revert .hgtags
40 40 $ hg tag -r 0 x y z y y z
41 41 abort: tag names must be unique
42 42 [255]
43 $ hg tag tap nada dot tip null .
43 $ hg tag tap nada dot tip
44 44 abort: the name 'tip' is reserved
45 45 [255]
46 $ hg tag .
47 abort: the name '.' is reserved
48 [255]
49 $ hg tag null
50 abort: the name 'null' is reserved
51 [255]
46 52 $ hg tag "bleah"
47 53 abort: tag 'bleah' already exists (use -f to force)
48 54 [255]
49 55 $ hg tag "blecch" "bleah"
50 56 abort: tag 'bleah' already exists (use -f to force)
51 57 [255]
52 58
53 59 $ hg tag --remove "blecch"
54 60 abort: tag 'blecch' does not exist
55 61 [255]
56 62 $ hg tag --remove "bleah" "blecch" "blough"
57 63 abort: tag 'blecch' does not exist
58 64 [255]
59 65
60 66 $ hg tag -r 0 "bleah0"
61 67 $ hg tag -l -r 1 "bleah1"
62 68 $ hg tag gack gawk gorp
63 69 $ hg tag -f gack
64 70 $ hg tag --remove gack gorp
65 71
66 72 $ hg tag "bleah "
67 73 abort: tag 'bleah' already exists (use -f to force)
68 74 [255]
69 75 $ hg tag " bleah"
70 76 abort: tag 'bleah' already exists (use -f to force)
71 77 [255]
72 78 $ hg tag " bleah"
73 79 abort: tag 'bleah' already exists (use -f to force)
74 80 [255]
75 81 $ hg tag -r 0 " bleahbleah "
76 82 $ hg tag -r 0 " bleah bleah "
77 83
78 84 $ cat .hgtags
79 85 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
80 86 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
81 87 336fccc858a4eb69609a291105009e484a6b6b8d gack
82 88 336fccc858a4eb69609a291105009e484a6b6b8d gawk
83 89 336fccc858a4eb69609a291105009e484a6b6b8d gorp
84 90 336fccc858a4eb69609a291105009e484a6b6b8d gack
85 91 799667b6f2d9b957f73fa644a918c2df22bab58f gack
86 92 799667b6f2d9b957f73fa644a918c2df22bab58f gack
87 93 0000000000000000000000000000000000000000 gack
88 94 336fccc858a4eb69609a291105009e484a6b6b8d gorp
89 95 0000000000000000000000000000000000000000 gorp
90 96 acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
91 97 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
92 98
93 99 $ cat .hg/localtags
94 100 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
95 101
96 102 tagging on a non-head revision
97 103
98 104 $ hg update 0
99 105 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
100 106 $ hg tag -l localblah
101 107 $ hg tag "foobar"
102 108 abort: not at a branch head (use -f to force)
103 109 [255]
104 110 $ hg tag -f "foobar"
105 111 $ cat .hgtags
106 112 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
107 113 $ cat .hg/localtags
108 114 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
109 115 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
110 116
111 117 $ hg tag -l 'xx
112 118 > newline'
113 119 abort: '\n' cannot be used in a tag name
114 120 [255]
115 121 $ hg tag -l 'xx:xx'
116 122 abort: ':' cannot be used in a tag name
117 123 [255]
118 124
119 125 cloning local tags
120 126
121 127 $ cd ..
122 128 $ hg -R test log -r0:5
123 129 changeset: 0:acb14030fe0a
124 130 tag: bleah
125 131 tag: bleah bleah
126 132 tag: bleah0
127 133 tag: bleahbleah
128 134 tag: foobar
129 135 tag: localblah
130 136 user: test
131 137 date: Thu Jan 01 00:00:00 1970 +0000
132 138 summary: test
133 139
134 140 changeset: 1:d4f0d2909abc
135 141 tag: bleah1
136 142 user: test
137 143 date: Thu Jan 01 00:00:00 1970 +0000
138 144 summary: Added tag bleah for changeset acb14030fe0a
139 145
140 146 changeset: 2:336fccc858a4
141 147 tag: gawk
142 148 user: test
143 149 date: Thu Jan 01 00:00:00 1970 +0000
144 150 summary: Added tag bleah0 for changeset acb14030fe0a
145 151
146 152 changeset: 3:799667b6f2d9
147 153 user: test
148 154 date: Thu Jan 01 00:00:00 1970 +0000
149 155 summary: Added tag gack, gawk, gorp for changeset 336fccc858a4
150 156
151 157 changeset: 4:154eeb7c0138
152 158 user: test
153 159 date: Thu Jan 01 00:00:00 1970 +0000
154 160 summary: Added tag gack for changeset 799667b6f2d9
155 161
156 162 changeset: 5:b4bb47aaff09
157 163 user: test
158 164 date: Thu Jan 01 00:00:00 1970 +0000
159 165 summary: Removed tag gack, gorp
160 166
161 167 $ hg clone -q -rbleah1 test test1
162 168 $ hg -R test1 parents --style=compact
163 169 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test
164 170 Added tag bleah for changeset acb14030fe0a
165 171
166 172 $ hg clone -q -r5 test#bleah1 test2
167 173 $ hg -R test2 parents --style=compact
168 174 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test
169 175 Removed tag gack, gorp
170 176
171 177 $ hg clone -q -U test#bleah1 test3
172 178 $ hg -R test3 parents --style=compact
173 179
174 180 $ cd test
175 181
176 182 Issue601: hg tag doesn't do the right thing if .hgtags or localtags
177 183 doesn't end with EOL
178 184
179 185 $ python << EOF
180 186 > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
181 187 > f = file('.hg/localtags', 'w'); f.write(last); f.close()
182 188 > EOF
183 189 $ cat .hg/localtags; echo
184 190 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
185 191 $ hg tag -l localnewline
186 192 $ cat .hg/localtags; echo
187 193 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
188 194 c2899151f4e76890c602a2597a650a72666681bf localnewline
189 195
190 196
191 197 $ python << EOF
192 198 > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
193 199 > f = file('.hgtags', 'w'); f.write(last); f.close()
194 200 > EOF
195 201 $ hg ci -m'broken manual edit of .hgtags'
196 202 $ cat .hgtags; echo
197 203 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
198 204 $ hg tag newline
199 205 $ cat .hgtags; echo
200 206 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
201 207 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
202 208
203 209
204 210 tag and branch using same name
205 211
206 212 $ hg branch tag-and-branch-same-name
207 213 marked working directory as branch tag-and-branch-same-name
208 214 (branches are permanent and global, did you want a bookmark?)
209 215 $ hg ci -m"discouraged"
210 216 $ hg tag tag-and-branch-same-name
211 217 warning: tag tag-and-branch-same-name conflicts with existing branch name
212 218
213 219 test custom commit messages
214 220
215 221 $ cat > editor.sh << '__EOF__'
216 222 > echo "custom tag message" > "$1"
217 223 > echo "second line" >> "$1"
218 224 > __EOF__
219 225 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
220 226 $ hg log -l1 --template "{desc}\n"
221 227 custom tag message
222 228 second line
223 229
224 230
225 231 local tag with .hgtags modified
226 232
227 233 $ hg tag hgtags-modified
228 234 $ hg rollback
229 235 repository tip rolled back to revision 13 (undo commit)
230 236 working directory now based on revision 13
231 237 $ hg st
232 238 M .hgtags
233 239 ? .hgtags.orig
234 240 ? editor.sh
235 241 $ hg tag --local baz
236 242 $ hg revert --no-backup .hgtags
237 243
238 244
239 245 tagging when at named-branch-head that's not a topo-head
240 246
241 247 $ hg up default
242 248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 249 $ hg merge -t internal:local
244 250 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
245 251 (branch merge, don't forget to commit)
246 252 $ hg ci -m 'merge named branch'
247 253 $ hg up 13
248 254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 255 $ hg tag new-topo-head
250 256
251 257 tagging on null rev
252 258
253 259 $ hg up null
254 260 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
255 261 $ hg tag nullrev
256 262 abort: not at a branch head (use -f to force)
257 263 [255]
258 264
259 265 $ hg init empty
260 266 $ hg tag -R empty nullrev
261 267 abort: null revision specified
262 268 [255]
263 269
264 270 $ hg tag -R empty -r 00000000000 -f nulltag
265 271 abort: null revision specified
266 272 [255]
267 273
268 274 $ cd ..
269 275
270 276 tagging on an uncommitted merge (issue2542)
271 277
272 278 $ hg init repo-tag-uncommitted-merge
273 279 $ cd repo-tag-uncommitted-merge
274 280 $ echo c1 > f1
275 281 $ hg ci -Am0
276 282 adding f1
277 283 $ echo c2 > f2
278 284 $ hg ci -Am1
279 285 adding f2
280 286 $ hg co -q 0
281 287 $ hg branch b1
282 288 marked working directory as branch b1
283 289 (branches are permanent and global, did you want a bookmark?)
284 290 $ hg ci -m2
285 291 $ hg up default
286 292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 293 $ hg merge b1
288 294 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 295 (branch merge, don't forget to commit)
290 296
291 297 $ hg tag t1
292 298 abort: uncommitted merge
293 299 [255]
294 300 $ hg status
295 301 $ hg tag --rev 1 t2
296 302 abort: uncommitted merge
297 303 [255]
298 304 $ hg tag --rev 1 --local t3
299 305 $ hg tags -v
300 306 tip 2:2a156e8887cc
301 307 t3 1:c3adabd1a5f4 local
302 308
303 309 $ cd ..
304 310
305 311 commit hook on tag used to be run without write lock - issue3344
306 312
307 313 $ hg init repo-tag
308 314 $ touch repo-tag/test
309 315 $ hg -R repo-tag commit -A -m "test"
310 316 adding test
311 317 $ hg init repo-tag-target
312 318 $ hg -R repo-tag --config hooks.commit="\"hg\" push \"`pwd`/repo-tag-target\"" tag tag
313 319 pushing to $TESTTMP/repo-tag-target
314 320 searching for changes
315 321 adding changesets
316 322 adding manifests
317 323 adding file changes
318 324 added 2 changesets with 2 changes to 2 files
319 325
General Comments 0
You need to be logged in to leave comments. Login now