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