Show More
@@ -1,750 +1,749 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH << EOF |
|
2 | 2 | > [experimental] |
|
3 | 3 | > hook-track-tags=1 |
|
4 | 4 | > [hooks] |
|
5 | > txnclose.track-tag=${TESTTMP}/taghook.sh | |
|
5 | > txnclose.track-tag=sh ${TESTTMP}/taghook.sh | |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ cat << EOF > taghook.sh |
|
9 | 9 | > #!/bin/sh |
|
10 | 10 | > # escape the "$" otherwise the test runner interpret it when writting the |
|
11 | 11 | > # file... |
|
12 | 12 | > if [ -n "\$HG_TAG_MOVED" ]; then |
|
13 | 13 | > echo 'hook: tag changes detected' |
|
14 | 14 | > sed 's/^/hook: /' .hg/changes/tags.changes |
|
15 | 15 | > fi |
|
16 | 16 | > EOF |
|
17 | $ chmod +x taghook.sh | |
|
18 | 17 | $ hg init test |
|
19 | 18 | $ cd test |
|
20 | 19 | |
|
21 | 20 | $ echo a > a |
|
22 | 21 | $ hg add a |
|
23 | 22 | $ hg commit -m "test" |
|
24 | 23 | $ hg history |
|
25 | 24 | changeset: 0:acb14030fe0a |
|
26 | 25 | tag: tip |
|
27 | 26 | user: test |
|
28 | 27 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
29 | 28 | summary: test |
|
30 | 29 | |
|
31 | 30 | |
|
32 | 31 | $ hg tag ' ' |
|
33 | 32 | abort: tag names cannot consist entirely of whitespace |
|
34 | 33 | [255] |
|
35 | 34 | |
|
36 | 35 | (this tests also that editor is not invoked, if '--edit' is not |
|
37 | 36 | specified) |
|
38 | 37 | |
|
39 | 38 | $ HGEDITOR=cat hg tag "bleah" |
|
40 | 39 | hook: tag changes detected |
|
41 | 40 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
42 | 41 | $ hg history |
|
43 | 42 | changeset: 1:d4f0d2909abc |
|
44 | 43 | tag: tip |
|
45 | 44 | user: test |
|
46 | 45 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
47 | 46 | summary: Added tag bleah for changeset acb14030fe0a |
|
48 | 47 | |
|
49 | 48 | changeset: 0:acb14030fe0a |
|
50 | 49 | tag: bleah |
|
51 | 50 | user: test |
|
52 | 51 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | 52 | summary: test |
|
54 | 53 | |
|
55 | 54 | |
|
56 | 55 | $ echo foo >> .hgtags |
|
57 | 56 | $ hg tag "bleah2" |
|
58 | 57 | abort: working copy of .hgtags is changed |
|
59 | 58 | (please commit .hgtags manually) |
|
60 | 59 | [255] |
|
61 | 60 | |
|
62 | 61 | $ hg revert .hgtags |
|
63 | 62 | $ hg tag -r 0 x y z y y z |
|
64 | 63 | abort: tag names must be unique |
|
65 | 64 | [255] |
|
66 | 65 | $ hg tag tap nada dot tip |
|
67 | 66 | abort: the name 'tip' is reserved |
|
68 | 67 | [255] |
|
69 | 68 | $ hg tag . |
|
70 | 69 | abort: the name '.' is reserved |
|
71 | 70 | [255] |
|
72 | 71 | $ hg tag null |
|
73 | 72 | abort: the name 'null' is reserved |
|
74 | 73 | [255] |
|
75 | 74 | $ hg tag "bleah" |
|
76 | 75 | abort: tag 'bleah' already exists (use -f to force) |
|
77 | 76 | [255] |
|
78 | 77 | $ hg tag "blecch" "bleah" |
|
79 | 78 | abort: tag 'bleah' already exists (use -f to force) |
|
80 | 79 | [255] |
|
81 | 80 | |
|
82 | 81 | $ hg tag --remove "blecch" |
|
83 | 82 | abort: tag 'blecch' does not exist |
|
84 | 83 | [255] |
|
85 | 84 | $ hg tag --remove "bleah" "blecch" "blough" |
|
86 | 85 | abort: tag 'blecch' does not exist |
|
87 | 86 | [255] |
|
88 | 87 | |
|
89 | 88 | $ hg tag -r 0 "bleah0" |
|
90 | 89 | hook: tag changes detected |
|
91 | 90 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 |
|
92 | 91 | $ hg tag -l -r 1 "bleah1" |
|
93 | 92 | $ hg tag gack gawk gorp |
|
94 | 93 | hook: tag changes detected |
|
95 | 94 | hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
96 | 95 | hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gawk |
|
97 | 96 | hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
98 | 97 | $ hg tag -f gack |
|
99 | 98 | hook: tag changes detected |
|
100 | 99 | hook: -M 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
101 | 100 | hook: +M 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
102 | 101 | $ hg tag --remove gack gorp |
|
103 | 102 | hook: tag changes detected |
|
104 | 103 | hook: -R 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
105 | 104 | hook: -R 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
106 | 105 | |
|
107 | 106 | $ hg tag "bleah " |
|
108 | 107 | abort: tag 'bleah' already exists (use -f to force) |
|
109 | 108 | [255] |
|
110 | 109 | $ hg tag " bleah" |
|
111 | 110 | abort: tag 'bleah' already exists (use -f to force) |
|
112 | 111 | [255] |
|
113 | 112 | $ hg tag " bleah" |
|
114 | 113 | abort: tag 'bleah' already exists (use -f to force) |
|
115 | 114 | [255] |
|
116 | 115 | $ hg tag -r 0 " bleahbleah " |
|
117 | 116 | hook: tag changes detected |
|
118 | 117 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah |
|
119 | 118 | $ hg tag -r 0 " bleah bleah " |
|
120 | 119 | hook: tag changes detected |
|
121 | 120 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah |
|
122 | 121 | |
|
123 | 122 | $ cat .hgtags |
|
124 | 123 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
125 | 124 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 |
|
126 | 125 | 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
127 | 126 | 336fccc858a4eb69609a291105009e484a6b6b8d gawk |
|
128 | 127 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
129 | 128 | 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
130 | 129 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
131 | 130 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
132 | 131 | 0000000000000000000000000000000000000000 gack |
|
133 | 132 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
134 | 133 | 0000000000000000000000000000000000000000 gorp |
|
135 | 134 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah |
|
136 | 135 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah |
|
137 | 136 | |
|
138 | 137 | $ cat .hg/localtags |
|
139 | 138 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
140 | 139 | |
|
141 | 140 | tagging on a non-head revision |
|
142 | 141 | |
|
143 | 142 | $ hg update 0 |
|
144 | 143 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
145 | 144 | $ hg tag -l localblah |
|
146 | 145 | $ hg tag "foobar" |
|
147 | 146 | abort: working directory is not at a branch head (use -f to force) |
|
148 | 147 | [255] |
|
149 | 148 | $ hg tag -f "foobar" |
|
150 | 149 | hook: tag changes detected |
|
151 | 150 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
152 | 151 | $ cat .hgtags |
|
153 | 152 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
154 | 153 | $ cat .hg/localtags |
|
155 | 154 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
156 | 155 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
157 | 156 | |
|
158 | 157 | $ hg tag -l 'xx |
|
159 | 158 | > newline' |
|
160 | 159 | abort: '\n' cannot be used in a name |
|
161 | 160 | [255] |
|
162 | 161 | $ hg tag -l 'xx:xx' |
|
163 | 162 | abort: ':' cannot be used in a name |
|
164 | 163 | [255] |
|
165 | 164 | |
|
166 | 165 | cloning local tags |
|
167 | 166 | |
|
168 | 167 | $ cd .. |
|
169 | 168 | $ hg -R test log -r0:5 |
|
170 | 169 | changeset: 0:acb14030fe0a |
|
171 | 170 | tag: bleah |
|
172 | 171 | tag: bleah bleah |
|
173 | 172 | tag: bleah0 |
|
174 | 173 | tag: bleahbleah |
|
175 | 174 | tag: foobar |
|
176 | 175 | tag: localblah |
|
177 | 176 | user: test |
|
178 | 177 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
179 | 178 | summary: test |
|
180 | 179 | |
|
181 | 180 | changeset: 1:d4f0d2909abc |
|
182 | 181 | tag: bleah1 |
|
183 | 182 | user: test |
|
184 | 183 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
185 | 184 | summary: Added tag bleah for changeset acb14030fe0a |
|
186 | 185 | |
|
187 | 186 | changeset: 2:336fccc858a4 |
|
188 | 187 | tag: gawk |
|
189 | 188 | user: test |
|
190 | 189 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
191 | 190 | summary: Added tag bleah0 for changeset acb14030fe0a |
|
192 | 191 | |
|
193 | 192 | changeset: 3:799667b6f2d9 |
|
194 | 193 | user: test |
|
195 | 194 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
196 | 195 | summary: Added tag gack, gawk, gorp for changeset 336fccc858a4 |
|
197 | 196 | |
|
198 | 197 | changeset: 4:154eeb7c0138 |
|
199 | 198 | user: test |
|
200 | 199 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
201 | 200 | summary: Added tag gack for changeset 799667b6f2d9 |
|
202 | 201 | |
|
203 | 202 | changeset: 5:b4bb47aaff09 |
|
204 | 203 | user: test |
|
205 | 204 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
206 | 205 | summary: Removed tag gack, gorp |
|
207 | 206 | |
|
208 | 207 | $ hg clone -q -rbleah1 test test1 |
|
209 | 208 | hook: tag changes detected |
|
210 | 209 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
211 | 210 | $ hg -R test1 parents --style=compact |
|
212 | 211 | 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test |
|
213 | 212 | Added tag bleah for changeset acb14030fe0a |
|
214 | 213 | |
|
215 | 214 | $ hg clone -q -r5 test#bleah1 test2 |
|
216 | 215 | hook: tag changes detected |
|
217 | 216 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
218 | 217 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 |
|
219 | 218 | hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gawk |
|
220 | 219 | $ hg -R test2 parents --style=compact |
|
221 | 220 | 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test |
|
222 | 221 | Removed tag gack, gorp |
|
223 | 222 | |
|
224 | 223 | $ hg clone -q -U test#bleah1 test3 |
|
225 | 224 | hook: tag changes detected |
|
226 | 225 | hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
227 | 226 | $ hg -R test3 parents --style=compact |
|
228 | 227 | |
|
229 | 228 | $ cd test |
|
230 | 229 | |
|
231 | 230 | Issue601: hg tag doesn't do the right thing if .hgtags or localtags |
|
232 | 231 | doesn't end with EOL |
|
233 | 232 | |
|
234 | 233 | $ python << EOF |
|
235 | 234 | > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close() |
|
236 | 235 | > f = file('.hg/localtags', 'w'); f.write(last); f.close() |
|
237 | 236 | > EOF |
|
238 | 237 | $ cat .hg/localtags; echo |
|
239 | 238 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
240 | 239 | $ hg tag -l localnewline |
|
241 | 240 | $ cat .hg/localtags; echo |
|
242 | 241 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
243 | 242 | c2899151f4e76890c602a2597a650a72666681bf localnewline |
|
244 | 243 | |
|
245 | 244 | |
|
246 | 245 | $ python << EOF |
|
247 | 246 | > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close() |
|
248 | 247 | > f = file('.hgtags', 'w'); f.write(last); f.close() |
|
249 | 248 | > EOF |
|
250 | 249 | $ hg ci -m'broken manual edit of .hgtags' |
|
251 | 250 | $ cat .hgtags; echo |
|
252 | 251 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
253 | 252 | $ hg tag newline |
|
254 | 253 | hook: tag changes detected |
|
255 | 254 | hook: +A a0eea09de1eeec777b46f2085260a373b2fbc293 newline |
|
256 | 255 | $ cat .hgtags; echo |
|
257 | 256 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
258 | 257 | a0eea09de1eeec777b46f2085260a373b2fbc293 newline |
|
259 | 258 | |
|
260 | 259 | |
|
261 | 260 | tag and branch using same name |
|
262 | 261 | |
|
263 | 262 | $ hg branch tag-and-branch-same-name |
|
264 | 263 | marked working directory as branch tag-and-branch-same-name |
|
265 | 264 | (branches are permanent and global, did you want a bookmark?) |
|
266 | 265 | $ hg ci -m"discouraged" |
|
267 | 266 | $ hg tag tag-and-branch-same-name |
|
268 | 267 | warning: tag tag-and-branch-same-name conflicts with existing branch name |
|
269 | 268 | hook: tag changes detected |
|
270 | 269 | hook: +A fc93d2ea1cd78e91216c6cfbbf26747c10ce11ae tag-and-branch-same-name |
|
271 | 270 | |
|
272 | 271 | test custom commit messages |
|
273 | 272 | |
|
274 | 273 | $ cat > editor.sh << '__EOF__' |
|
275 | 274 | > echo "==== before editing" |
|
276 | 275 | > cat "$1" |
|
277 | 276 | > echo "====" |
|
278 | 277 | > echo "custom tag message" > "$1" |
|
279 | 278 | > echo "second line" >> "$1" |
|
280 | 279 | > __EOF__ |
|
281 | 280 | |
|
282 | 281 | at first, test saving last-message.txt |
|
283 | 282 | |
|
284 | 283 | (test that editor is not invoked before transaction starting) |
|
285 | 284 | |
|
286 | 285 | $ cat > .hg/hgrc << '__EOF__' |
|
287 | 286 | > [hooks] |
|
288 | 287 | > # this failure occurs before editor invocation |
|
289 | 288 | > pretag.test-saving-lastmessage = false |
|
290 | 289 | > __EOF__ |
|
291 | 290 | $ rm -f .hg/last-message.txt |
|
292 | 291 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e |
|
293 | 292 | abort: pretag.test-saving-lastmessage hook exited with status 1 |
|
294 | 293 | [255] |
|
295 | 294 | $ test -f .hg/last-message.txt |
|
296 | 295 | [1] |
|
297 | 296 | |
|
298 | 297 | (test that editor is invoked and commit message is saved into |
|
299 | 298 | "last-message.txt") |
|
300 | 299 | |
|
301 | 300 | $ cat >> .hg/hgrc << '__EOF__' |
|
302 | 301 | > [hooks] |
|
303 | 302 | > pretag.test-saving-lastmessage = |
|
304 | 303 | > # this failure occurs after editor invocation |
|
305 | 304 | > pretxncommit.unexpectedabort = false |
|
306 | 305 | > __EOF__ |
|
307 | 306 | |
|
308 | 307 | (this tests also that editor is invoked, if '--edit' is specified, |
|
309 | 308 | regardless of '--message') |
|
310 | 309 | |
|
311 | 310 | $ rm -f .hg/last-message.txt |
|
312 | 311 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar" |
|
313 | 312 | ==== before editing |
|
314 | 313 | foo bar |
|
315 | 314 | |
|
316 | 315 | |
|
317 | 316 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
318 | 317 | HG: Leave message empty to abort commit. |
|
319 | 318 | HG: -- |
|
320 | 319 | HG: user: test |
|
321 | 320 | HG: branch 'tag-and-branch-same-name' |
|
322 | 321 | HG: changed .hgtags |
|
323 | 322 | ==== |
|
324 | 323 | note: commit message saved in .hg/last-message.txt |
|
325 | 324 | transaction abort! |
|
326 | 325 | rollback completed |
|
327 | 326 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
328 | 327 | [255] |
|
329 | 328 | $ cat .hg/last-message.txt |
|
330 | 329 | custom tag message |
|
331 | 330 | second line |
|
332 | 331 | |
|
333 | 332 | $ cat >> .hg/hgrc << '__EOF__' |
|
334 | 333 | > [hooks] |
|
335 | 334 | > pretxncommit.unexpectedabort = |
|
336 | 335 | > __EOF__ |
|
337 | 336 | $ hg status .hgtags |
|
338 | 337 | M .hgtags |
|
339 | 338 | $ hg revert --no-backup -q .hgtags |
|
340 | 339 | |
|
341 | 340 | then, test custom commit message itself |
|
342 | 341 | |
|
343 | 342 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e |
|
344 | 343 | ==== before editing |
|
345 | 344 | Added tag custom-tag for changeset 75a534207be6 |
|
346 | 345 | |
|
347 | 346 | |
|
348 | 347 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
349 | 348 | HG: Leave message empty to abort commit. |
|
350 | 349 | HG: -- |
|
351 | 350 | HG: user: test |
|
352 | 351 | HG: branch 'tag-and-branch-same-name' |
|
353 | 352 | HG: changed .hgtags |
|
354 | 353 | ==== |
|
355 | 354 | hook: tag changes detected |
|
356 | 355 | hook: +A 75a534207be6b03576e0c7a4fa5708d045f1c876 custom-tag |
|
357 | 356 | $ hg log -l1 --template "{desc}\n" |
|
358 | 357 | custom tag message |
|
359 | 358 | second line |
|
360 | 359 | |
|
361 | 360 | |
|
362 | 361 | local tag with .hgtags modified |
|
363 | 362 | |
|
364 | 363 | $ hg tag hgtags-modified |
|
365 | 364 | hook: tag changes detected |
|
366 | 365 | hook: +A 0f26aaea6f74c3ed6c4aad8844403c9ba128d23a hgtags-modified |
|
367 | 366 | $ hg rollback |
|
368 | 367 | repository tip rolled back to revision 13 (undo commit) |
|
369 | 368 | working directory now based on revision 13 |
|
370 | 369 | $ hg st |
|
371 | 370 | M .hgtags |
|
372 | 371 | ? .hgtags.orig |
|
373 | 372 | ? editor.sh |
|
374 | 373 | $ hg tag --local baz |
|
375 | 374 | $ hg revert --no-backup .hgtags |
|
376 | 375 | |
|
377 | 376 | |
|
378 | 377 | tagging when at named-branch-head that's not a topo-head |
|
379 | 378 | |
|
380 | 379 | $ hg up default |
|
381 | 380 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 381 | $ hg merge -t internal:local |
|
383 | 382 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
384 | 383 | (branch merge, don't forget to commit) |
|
385 | 384 | $ hg ci -m 'merge named branch' |
|
386 | 385 | hook: tag changes detected |
|
387 | 386 | hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
388 | 387 | hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah |
|
389 | 388 | hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 |
|
390 | 389 | hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah |
|
391 | 390 | hook: -R 336fccc858a4eb69609a291105009e484a6b6b8d gawk |
|
392 | 391 | $ hg up 13 |
|
393 | 392 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
394 | 393 | $ hg tag new-topo-head |
|
395 | 394 | hook: tag changes detected |
|
396 | 395 | hook: +A 0f26aaea6f74c3ed6c4aad8844403c9ba128d23a new-topo-head |
|
397 | 396 | |
|
398 | 397 | tagging on null rev |
|
399 | 398 | |
|
400 | 399 | $ hg up null |
|
401 | 400 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
402 | 401 | $ hg tag nullrev |
|
403 | 402 | abort: working directory is not at a branch head (use -f to force) |
|
404 | 403 | [255] |
|
405 | 404 | |
|
406 | 405 | $ hg init empty |
|
407 | 406 | $ hg tag -R empty nullrev |
|
408 | 407 | abort: cannot tag null revision |
|
409 | 408 | [255] |
|
410 | 409 | |
|
411 | 410 | $ hg tag -R empty -r 00000000000 -f nulltag |
|
412 | 411 | abort: cannot tag null revision |
|
413 | 412 | [255] |
|
414 | 413 | |
|
415 | 414 | $ cd .. |
|
416 | 415 | |
|
417 | 416 | tagging on an uncommitted merge (issue2542) |
|
418 | 417 | |
|
419 | 418 | $ hg init repo-tag-uncommitted-merge |
|
420 | 419 | $ cd repo-tag-uncommitted-merge |
|
421 | 420 | $ echo c1 > f1 |
|
422 | 421 | $ hg ci -Am0 |
|
423 | 422 | adding f1 |
|
424 | 423 | $ echo c2 > f2 |
|
425 | 424 | $ hg ci -Am1 |
|
426 | 425 | adding f2 |
|
427 | 426 | $ hg co -q 0 |
|
428 | 427 | $ hg branch b1 |
|
429 | 428 | marked working directory as branch b1 |
|
430 | 429 | (branches are permanent and global, did you want a bookmark?) |
|
431 | 430 | $ hg ci -m2 |
|
432 | 431 | $ hg up default |
|
433 | 432 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
434 | 433 | $ hg merge b1 |
|
435 | 434 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
436 | 435 | (branch merge, don't forget to commit) |
|
437 | 436 | |
|
438 | 437 | $ hg tag t1 |
|
439 | 438 | abort: uncommitted merge |
|
440 | 439 | [255] |
|
441 | 440 | $ hg status |
|
442 | 441 | $ hg tag --rev 1 t2 |
|
443 | 442 | abort: uncommitted merge |
|
444 | 443 | [255] |
|
445 | 444 | $ hg tag --rev 1 --local t3 |
|
446 | 445 | $ hg tags -v |
|
447 | 446 | tip 2:2a156e8887cc |
|
448 | 447 | t3 1:c3adabd1a5f4 local |
|
449 | 448 | |
|
450 | 449 | $ cd .. |
|
451 | 450 | |
|
452 | 451 | commit hook on tag used to be run without write lock - issue3344 |
|
453 | 452 | |
|
454 | 453 | $ hg init repo-tag |
|
455 | 454 | $ touch repo-tag/test |
|
456 | 455 | $ hg -R repo-tag commit -A -m "test" |
|
457 | 456 | adding test |
|
458 | 457 | $ hg init repo-tag-target |
|
459 | 458 | $ cat > "$TESTTMP/issue3344.sh" <<EOF |
|
460 | 459 | > hg push "$TESTTMP/repo-tag-target" |
|
461 | 460 | > EOF |
|
462 | 461 | $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag |
|
463 | 462 | hook: tag changes detected |
|
464 | 463 | hook: +A be090ea6625635128e90f7d89df8beeb2bcc1653 tag |
|
465 | 464 | pushing to $TESTTMP/repo-tag-target (glob) |
|
466 | 465 | searching for changes |
|
467 | 466 | adding changesets |
|
468 | 467 | adding manifests |
|
469 | 468 | adding file changes |
|
470 | 469 | added 2 changesets with 2 changes to 2 files |
|
471 | 470 | hook: tag changes detected |
|
472 | 471 | hook: +A be090ea6625635128e90f7d89df8beeb2bcc1653 tag |
|
473 | 472 | |
|
474 | 473 | automatically merge resolvable tag conflicts (i.e. tags that differ in rank) |
|
475 | 474 | create two clones with some different tags as well as some common tags |
|
476 | 475 | check that we can merge tags that differ in rank |
|
477 | 476 | |
|
478 | 477 | $ hg init repo-automatic-tag-merge |
|
479 | 478 | $ cd repo-automatic-tag-merge |
|
480 | 479 | $ echo c0 > f0 |
|
481 | 480 | $ hg ci -A -m0 |
|
482 | 481 | adding f0 |
|
483 | 482 | $ hg tag tbase |
|
484 | 483 | hook: tag changes detected |
|
485 | 484 | hook: +A 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
486 | 485 | $ hg up -qr '.^' |
|
487 | 486 | $ hg log -r 'wdir()' -T "{latesttagdistance}\n" |
|
488 | 487 | 1 |
|
489 | 488 | $ hg up -q |
|
490 | 489 | $ hg log -r 'wdir()' -T "{latesttagdistance}\n" |
|
491 | 490 | 2 |
|
492 | 491 | $ cd .. |
|
493 | 492 | $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone |
|
494 | 493 | updating to branch default |
|
495 | 494 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
496 | 495 | $ cd repo-automatic-tag-merge-clone |
|
497 | 496 | $ echo c1 > f1 |
|
498 | 497 | $ hg ci -A -m1 |
|
499 | 498 | adding f1 |
|
500 | 499 | $ hg tag t1 t2 t3 |
|
501 | 500 | hook: tag changes detected |
|
502 | 501 | hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
503 | 502 | hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
504 | 503 | hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
505 | 504 | $ hg tag --remove t2 |
|
506 | 505 | hook: tag changes detected |
|
507 | 506 | hook: -R 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
508 | 507 | $ hg tag t5 |
|
509 | 508 | hook: tag changes detected |
|
510 | 509 | hook: +A 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
511 | 510 | $ echo c2 > f2 |
|
512 | 511 | $ hg ci -A -m2 |
|
513 | 512 | adding f2 |
|
514 | 513 | $ hg tag -f t3 |
|
515 | 514 | hook: tag changes detected |
|
516 | 515 | hook: -M 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
517 | 516 | hook: +M 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
518 | 517 | |
|
519 | 518 | $ cd ../repo-automatic-tag-merge |
|
520 | 519 | $ echo c3 > f3 |
|
521 | 520 | $ hg ci -A -m3 |
|
522 | 521 | adding f3 |
|
523 | 522 | $ hg tag -f t4 t5 t6 |
|
524 | 523 | hook: tag changes detected |
|
525 | 524 | hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
526 | 525 | hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
527 | 526 | hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
528 | 527 | |
|
529 | 528 | $ hg up -q '.^' |
|
530 | 529 | $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n" |
|
531 | 530 | 1 changes since t4:t5:t6 |
|
532 | 531 | $ hg log -r '.' -T "{changessincelatesttag} changes since {latesttag}\n" |
|
533 | 532 | 0 changes since t4:t5:t6 |
|
534 | 533 | $ echo c5 > f3 |
|
535 | 534 | $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n" |
|
536 | 535 | 1 changes since t4:t5:t6 |
|
537 | 536 | $ hg up -qC |
|
538 | 537 | |
|
539 | 538 | $ hg tag --remove t5 |
|
540 | 539 | hook: tag changes detected |
|
541 | 540 | hook: -R 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
542 | 541 | $ echo c4 > f4 |
|
543 | 542 | $ hg log -r '.' -T "{changessincelatesttag} changes since {latesttag}\n" |
|
544 | 543 | 2 changes since t4:t6 |
|
545 | 544 | $ hg log -r '.' -T "{latesttag % '{latesttag}\n'}" |
|
546 | 545 | t4 |
|
547 | 546 | t6 |
|
548 | 547 | $ hg log -r '.' -T "{latesttag('t4') % 'T: {tag}, C: {changes}, D: {distance}\n'}" |
|
549 | 548 | T: t4, C: 2, D: 2 |
|
550 | 549 | $ hg log -r '.' -T "{latesttag('re:\d') % 'T: {tag}, C: {changes}, D: {distance}\n'}" |
|
551 | 550 | T: t4, C: 2, D: 2 |
|
552 | 551 | T: t6, C: 2, D: 2 |
|
553 | 552 | $ hg log -r . -T '{join(latesttag(), "*")}\n' |
|
554 | 553 | t4*t6 |
|
555 | 554 | $ hg ci -A -m4 |
|
556 | 555 | adding f4 |
|
557 | 556 | $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n" |
|
558 | 557 | 4 changes since t4:t6 |
|
559 | 558 | $ hg tag t2 |
|
560 | 559 | hook: tag changes detected |
|
561 | 560 | hook: +A 929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
562 | 561 | $ hg tag -f t6 |
|
563 | 562 | hook: tag changes detected |
|
564 | 563 | hook: -M 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
565 | 564 | hook: +M 09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
566 | 565 | |
|
567 | 566 | $ cd ../repo-automatic-tag-merge-clone |
|
568 | 567 | $ hg pull |
|
569 | 568 | pulling from $TESTTMP/repo-automatic-tag-merge (glob) |
|
570 | 569 | searching for changes |
|
571 | 570 | adding changesets |
|
572 | 571 | adding manifests |
|
573 | 572 | adding file changes |
|
574 | 573 | added 6 changesets with 6 changes to 3 files (+1 heads) |
|
575 | 574 | hook: tag changes detected |
|
576 | 575 | hook: +A 929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
577 | 576 | hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
578 | 577 | hook: -R 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
579 | 578 | hook: +A 09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
580 | 579 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
581 | 580 | $ hg merge --tool internal:tagmerge |
|
582 | 581 | merging .hgtags |
|
583 | 582 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
584 | 583 | (branch merge, don't forget to commit) |
|
585 | 584 | $ hg status |
|
586 | 585 | M .hgtags |
|
587 | 586 | M f3 |
|
588 | 587 | M f4 |
|
589 | 588 | $ hg resolve -l |
|
590 | 589 | R .hgtags |
|
591 | 590 | $ cat .hgtags |
|
592 | 591 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
593 | 592 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
594 | 593 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
595 | 594 | 09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
596 | 595 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
597 | 596 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
598 | 597 | 929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
599 | 598 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
600 | 599 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
601 | 600 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
602 | 601 | 0000000000000000000000000000000000000000 t2 |
|
603 | 602 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
604 | 603 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
605 | 604 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
606 | 605 | 0000000000000000000000000000000000000000 t5 |
|
607 | 606 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
608 | 607 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
609 | 608 | |
|
610 | 609 | check that the merge tried to minimize the diff with the first merge parent |
|
611 | 610 | |
|
612 | 611 | $ hg diff --git -r 'p1()' .hgtags |
|
613 | 612 | diff --git a/.hgtags b/.hgtags |
|
614 | 613 | --- a/.hgtags |
|
615 | 614 | +++ b/.hgtags |
|
616 | 615 | @@ -1,9 +1,17 @@ |
|
617 | 616 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
618 | 617 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
619 | 618 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
620 | 619 | +09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
621 | 620 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
622 | 621 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
623 | 622 | +929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
624 | 623 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
625 | 624 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
626 | 625 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
627 | 626 | 0000000000000000000000000000000000000000 t2 |
|
628 | 627 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
629 | 628 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
630 | 629 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
631 | 630 | +0000000000000000000000000000000000000000 t5 |
|
632 | 631 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
633 | 632 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
634 | 633 | |
|
635 | 634 | detect merge tag conflicts |
|
636 | 635 | |
|
637 | 636 | $ hg update -C -r tip |
|
638 | 637 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
639 | 638 | $ hg tag t7 |
|
640 | 639 | hook: tag changes detected |
|
641 | 640 | hook: +A b325cc5b642c5b465bdbe8c09627cb372de3d47d t7 |
|
642 | 641 | $ hg update -C -r 'first(sort(head()))' |
|
643 | 642 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
644 | 643 | $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags |
|
645 | 644 | $ hg commit -m "manually add conflicting t7 tag" |
|
646 | 645 | hook: tag changes detected |
|
647 | 646 | hook: -R 929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
648 | 647 | hook: +A 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
649 | 648 | hook: -M b325cc5b642c5b465bdbe8c09627cb372de3d47d t7 |
|
650 | 649 | hook: +M ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
651 | 650 | $ hg merge --tool internal:tagmerge |
|
652 | 651 | merging .hgtags |
|
653 | 652 | automatic .hgtags merge failed |
|
654 | 653 | the following 1 tags are in conflict: t7 |
|
655 | 654 | automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice) |
|
656 | 655 | 2 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
657 | 656 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
658 | 657 | [1] |
|
659 | 658 | $ hg resolve -l |
|
660 | 659 | U .hgtags |
|
661 | 660 | $ cat .hgtags |
|
662 | 661 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
663 | 662 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
664 | 663 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
665 | 664 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
666 | 665 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
667 | 666 | 0000000000000000000000000000000000000000 t2 |
|
668 | 667 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
669 | 668 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
670 | 669 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
671 | 670 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
672 | 671 | |
|
673 | 672 | $ cd .. |
|
674 | 673 | |
|
675 | 674 | handle the loss of tags |
|
676 | 675 | |
|
677 | 676 | $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags |
|
678 | 677 | updating to branch default |
|
679 | 678 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
680 | 679 | $ cd repo-merge-lost-tags |
|
681 | 680 | $ echo c5 > f5 |
|
682 | 681 | $ hg ci -A -m5 |
|
683 | 682 | adding f5 |
|
684 | 683 | $ hg tag -f t7 |
|
685 | 684 | hook: tag changes detected |
|
686 | 685 | hook: -M ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
687 | 686 | hook: +M fd3a9e394ce3afb354a496323bf68ac1755a30de t7 |
|
688 | 687 | $ hg update -r 'p1(t7)' |
|
689 | 688 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
690 | 689 | $ printf '' > .hgtags |
|
691 | 690 | $ hg commit -m 'delete all tags' |
|
692 | 691 | created new head |
|
693 | 692 | $ hg log -r 'max(t7::)' |
|
694 | 693 | changeset: 17:ffe462b50880 |
|
695 | 694 | user: test |
|
696 | 695 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
697 | 696 | summary: Added tag t7 for changeset fd3a9e394ce3 |
|
698 | 697 | |
|
699 | 698 | $ hg update -r 'max(t7::)' |
|
700 | 699 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
701 | 700 | $ hg merge -r tip --tool internal:tagmerge |
|
702 | 701 | merging .hgtags |
|
703 | 702 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
704 | 703 | (branch merge, don't forget to commit) |
|
705 | 704 | $ hg resolve -l |
|
706 | 705 | R .hgtags |
|
707 | 706 | $ cat .hgtags |
|
708 | 707 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
709 | 708 | 0000000000000000000000000000000000000000 tbase |
|
710 | 709 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
711 | 710 | 0000000000000000000000000000000000000000 t1 |
|
712 | 711 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
713 | 712 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
714 | 713 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
715 | 714 | 0000000000000000000000000000000000000000 t2 |
|
716 | 715 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
717 | 716 | 0000000000000000000000000000000000000000 t5 |
|
718 | 717 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
719 | 718 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
720 | 719 | 0000000000000000000000000000000000000000 t3 |
|
721 | 720 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
722 | 721 | 0000000000000000000000000000000000000000 t7 |
|
723 | 722 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
724 | 723 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 |
|
725 | 724 | |
|
726 | 725 | also check that we minimize the diff with the 1st merge parent |
|
727 | 726 | |
|
728 | 727 | $ hg diff --git -r 'p1()' .hgtags |
|
729 | 728 | diff --git a/.hgtags b/.hgtags |
|
730 | 729 | --- a/.hgtags |
|
731 | 730 | +++ b/.hgtags |
|
732 | 731 | @@ -1,12 +1,17 @@ |
|
733 | 732 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
734 | 733 | +0000000000000000000000000000000000000000 tbase |
|
735 | 734 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
736 | 735 | +0000000000000000000000000000000000000000 t1 |
|
737 | 736 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
738 | 737 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
739 | 738 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
740 | 739 | 0000000000000000000000000000000000000000 t2 |
|
741 | 740 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
742 | 741 | +0000000000000000000000000000000000000000 t5 |
|
743 | 742 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
744 | 743 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
745 | 744 | +0000000000000000000000000000000000000000 t3 |
|
746 | 745 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
747 | 746 | +0000000000000000000000000000000000000000 t7 |
|
748 | 747 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
749 | 748 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 |
|
750 | 749 |
General Comments 0
You need to be logged in to leave comments.
Login now