Show More
@@ -1,691 +1,707 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [commands] |
|
3 | 3 | > status.verbose=1 |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | # Construct the following history tree: |
|
7 | 7 | # |
|
8 | 8 | # @ 5:e1bb631146ca b1 |
|
9 | 9 | # | |
|
10 | 10 | # o 4:a4fdb3b883c4 0:b608b9236435 b1 |
|
11 | 11 | # | |
|
12 | 12 | # | o 3:4b57d2520816 1:44592833ba9f |
|
13 | 13 | # | | |
|
14 | 14 | # | | o 2:063f31070f65 |
|
15 | 15 | # | |/ |
|
16 | 16 | # | o 1:44592833ba9f |
|
17 | 17 | # |/ |
|
18 | 18 | # o 0:b608b9236435 |
|
19 | 19 | |
|
20 | 20 | $ mkdir b1 |
|
21 | 21 | $ cd b1 |
|
22 | 22 | $ hg init |
|
23 | 23 | $ echo foo > foo |
|
24 | 24 | $ echo zero > a |
|
25 | 25 | $ hg init sub |
|
26 | 26 | $ echo suba > sub/suba |
|
27 | 27 | $ hg --cwd sub ci -Am addsuba |
|
28 | 28 | adding suba |
|
29 | 29 | $ echo 'sub = sub' > .hgsub |
|
30 | 30 | $ hg ci -qAm0 |
|
31 | 31 | $ echo one > a ; hg ci -m1 |
|
32 | 32 | $ echo two > a ; hg ci -m2 |
|
33 | 33 | $ hg up -q 1 |
|
34 | 34 | $ echo three > a ; hg ci -qm3 |
|
35 | 35 | $ hg up -q 0 |
|
36 | 36 | $ hg branch -q b1 |
|
37 | 37 | $ echo four > a ; hg ci -qm4 |
|
38 | 38 | $ echo five > a ; hg ci -qm5 |
|
39 | 39 | |
|
40 | 40 | Initial repo state: |
|
41 | 41 | |
|
42 | 42 | $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n' |
|
43 | 43 | @ 5:ff252e8273df b1 |
|
44 | 44 | | |
|
45 | 45 | o 4:d047485b3896 0:60829823a42a b1 |
|
46 | 46 | | |
|
47 | 47 | | o 3:6efa171f091b 1:0786582aa4b1 |
|
48 | 48 | | | |
|
49 | 49 | | | o 2:bd10386d478c |
|
50 | 50 | | |/ |
|
51 | 51 | | o 1:0786582aa4b1 |
|
52 | 52 | |/ |
|
53 | 53 | o 0:60829823a42a |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | Make sure update doesn't assume b1 is a repository if invoked from outside: |
|
57 | 57 | |
|
58 | 58 | $ cd .. |
|
59 | 59 | $ hg update b1 |
|
60 | 60 | abort: no repository found in '$TESTTMP' (.hg not found)! |
|
61 | 61 | [255] |
|
62 | 62 | $ cd b1 |
|
63 | 63 | |
|
64 | 64 | Test helper functions: |
|
65 | 65 | |
|
66 | 66 | $ revtest () { |
|
67 | 67 | > msg=$1 |
|
68 | 68 | > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
|
69 | 69 | > startrev=$3 |
|
70 | 70 | > targetrev=$4 |
|
71 | 71 | > opt=$5 |
|
72 | 72 | > hg up -qC $startrev |
|
73 | 73 | > test $dirtyflag = dirty && echo dirty > foo |
|
74 | 74 | > test $dirtyflag = dirtysub && echo dirty > sub/suba |
|
75 | 75 | > hg up $opt $targetrev |
|
76 | 76 | > hg parent --template 'parent={rev}\n' |
|
77 | 77 | > hg stat -S |
|
78 | 78 | > } |
|
79 | 79 | |
|
80 | 80 | $ norevtest () { |
|
81 | 81 | > msg=$1 |
|
82 | 82 | > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
|
83 | 83 | > startrev=$3 |
|
84 | 84 | > opt=$4 |
|
85 | 85 | > hg up -qC $startrev |
|
86 | 86 | > test $dirtyflag = dirty && echo dirty > foo |
|
87 | 87 | > test $dirtyflag = dirtysub && echo dirty > sub/suba |
|
88 | 88 | > hg up $opt |
|
89 | 89 | > hg parent --template 'parent={rev}\n' |
|
90 | 90 | > hg stat -S |
|
91 | 91 | > } |
|
92 | 92 | |
|
93 | 93 | Test cases are documented in a table in the update function of merge.py. |
|
94 | 94 | Cases are run as shown in that table, row by row. |
|
95 | 95 | |
|
96 | 96 | $ norevtest 'none clean linear' clean 4 |
|
97 | 97 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 98 | parent=5 |
|
99 | 99 | |
|
100 | 100 | $ norevtest 'none clean same' clean 2 |
|
101 | 101 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | updated to "bd10386d478c: 2" |
|
103 | 103 | 1 other heads for branch "default" |
|
104 | 104 | parent=2 |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | $ revtest 'none clean linear' clean 1 2 |
|
108 | 108 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
109 | 109 | parent=2 |
|
110 | 110 | |
|
111 | 111 | $ revtest 'none clean same' clean 2 3 |
|
112 | 112 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
113 | 113 | parent=3 |
|
114 | 114 | |
|
115 | 115 | $ revtest 'none clean cross' clean 3 4 |
|
116 | 116 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
117 | 117 | parent=4 |
|
118 | 118 | |
|
119 | 119 | |
|
120 | 120 | $ revtest 'none dirty linear' dirty 1 2 |
|
121 | 121 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
122 | 122 | parent=2 |
|
123 | 123 | M foo |
|
124 | 124 | |
|
125 | 125 | $ revtest 'none dirtysub linear' dirtysub 1 2 |
|
126 | 126 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | parent=2 |
|
128 | 128 | M sub/suba |
|
129 | 129 | |
|
130 | 130 | $ revtest 'none dirty same' dirty 2 3 |
|
131 | 131 | abort: uncommitted changes |
|
132 | 132 | (commit or update --clean to discard changes) |
|
133 | 133 | parent=2 |
|
134 | 134 | M foo |
|
135 | 135 | |
|
136 | 136 | $ revtest 'none dirtysub same' dirtysub 2 3 |
|
137 | 137 | abort: uncommitted changes |
|
138 | 138 | (commit or update --clean to discard changes) |
|
139 | 139 | parent=2 |
|
140 | 140 | M sub/suba |
|
141 | 141 | |
|
142 | 142 | $ revtest 'none dirty cross' dirty 3 4 |
|
143 | 143 | abort: uncommitted changes |
|
144 | 144 | (commit or update --clean to discard changes) |
|
145 | 145 | parent=3 |
|
146 | 146 | M foo |
|
147 | 147 | |
|
148 | 148 | $ norevtest 'none dirty cross' dirty 2 |
|
149 | 149 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
150 | 150 | updated to "bd10386d478c: 2" |
|
151 | 151 | 1 other heads for branch "default" |
|
152 | 152 | parent=2 |
|
153 | 153 | M foo |
|
154 | 154 | |
|
155 | 155 | $ revtest 'none dirtysub cross' dirtysub 3 4 |
|
156 | 156 | abort: uncommitted changes |
|
157 | 157 | (commit or update --clean to discard changes) |
|
158 | 158 | parent=3 |
|
159 | 159 | M sub/suba |
|
160 | 160 | |
|
161 | 161 | $ revtest '-C dirty linear' dirty 1 2 -C |
|
162 | 162 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 163 | parent=2 |
|
164 | 164 | |
|
165 | 165 | $ revtest '-c dirty linear' dirty 1 2 -c |
|
166 | 166 | abort: uncommitted changes |
|
167 | 167 | parent=1 |
|
168 | 168 | M foo |
|
169 | 169 | |
|
170 | 170 | $ revtest '-m dirty linear' dirty 1 2 -m |
|
171 | 171 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
172 | 172 | parent=2 |
|
173 | 173 | M foo |
|
174 | 174 | |
|
175 | 175 | $ revtest '-m dirty cross' dirty 3 4 -m |
|
176 | 176 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
177 | 177 | parent=4 |
|
178 | 178 | M foo |
|
179 | 179 | |
|
180 | 180 | $ revtest '-c dirtysub linear' dirtysub 1 2 -c |
|
181 | 181 | abort: uncommitted changes in subrepository "sub" |
|
182 | 182 | parent=1 |
|
183 | 183 | M sub/suba |
|
184 | 184 | |
|
185 | 185 | $ norevtest '-c clean same' clean 2 -c |
|
186 | 186 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
187 | 187 | updated to "bd10386d478c: 2" |
|
188 | 188 | 1 other heads for branch "default" |
|
189 | 189 | parent=2 |
|
190 | 190 | |
|
191 | 191 | $ revtest '-cC dirty linear' dirty 1 2 -cC |
|
192 | 192 | abort: can only specify one of -C/--clean, -c/--check, or -m/--merge |
|
193 | 193 | parent=1 |
|
194 | 194 | M foo |
|
195 | 195 | |
|
196 | 196 | $ revtest '-mc dirty linear' dirty 1 2 -mc |
|
197 | 197 | abort: can only specify one of -C/--clean, -c/--check, or -m/--merge |
|
198 | 198 | parent=1 |
|
199 | 199 | M foo |
|
200 | 200 | |
|
201 | 201 | $ revtest '-mC dirty linear' dirty 1 2 -mC |
|
202 | 202 | abort: can only specify one of -C/--clean, -c/--check, or -m/--merge |
|
203 | 203 | parent=1 |
|
204 | 204 | M foo |
|
205 | 205 | |
|
206 | 206 | $ echo '[commands]' >> .hg/hgrc |
|
207 | 207 | $ echo 'update.check = abort' >> .hg/hgrc |
|
208 | 208 | |
|
209 | 209 | $ revtest 'none dirty linear' dirty 1 2 |
|
210 | 210 | abort: uncommitted changes |
|
211 | 211 | parent=1 |
|
212 | 212 | M foo |
|
213 | 213 | |
|
214 | 214 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
215 | 215 | abort: uncommitted changes |
|
216 | 216 | parent=1 |
|
217 | 217 | M foo |
|
218 | 218 | |
|
219 | 219 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
220 | 220 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 221 | parent=2 |
|
222 | 222 | |
|
223 | 223 | $ echo 'update.check = none' >> .hg/hgrc |
|
224 | 224 | |
|
225 | 225 | $ revtest 'none dirty cross' dirty 3 4 |
|
226 | 226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 227 | parent=4 |
|
228 | 228 | M foo |
|
229 | 229 | |
|
230 | 230 | $ revtest 'none dirty linear' dirty 1 2 |
|
231 | 231 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 232 | parent=2 |
|
233 | 233 | M foo |
|
234 | 234 | |
|
235 | 235 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
236 | 236 | abort: uncommitted changes |
|
237 | 237 | parent=1 |
|
238 | 238 | M foo |
|
239 | 239 | |
|
240 | 240 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
241 | 241 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
242 | 242 | parent=2 |
|
243 | 243 | |
|
244 | 244 | $ hg co -qC 3 |
|
245 | 245 | $ echo dirty >> a |
|
246 | 246 | $ hg co --tool :merge3 4 |
|
247 | 247 | merging a |
|
248 | 248 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
249 | 249 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
250 | 250 | use 'hg resolve' to retry unresolved file merges |
|
251 | 251 | [1] |
|
252 | 252 | $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n' |
|
253 | 253 | o 5:ff252e8273df b1 |
|
254 | 254 | | |
|
255 | 255 | @ 4:d047485b3896 0:60829823a42a b1 |
|
256 | 256 | | |
|
257 | 257 | | % 3:6efa171f091b 1:0786582aa4b1 |
|
258 | 258 | | | |
|
259 | 259 | | | o 2:bd10386d478c |
|
260 | 260 | | |/ |
|
261 | 261 | | o 1:0786582aa4b1 |
|
262 | 262 | |/ |
|
263 | 263 | o 0:60829823a42a |
|
264 | 264 | |
|
265 | 265 | $ hg st |
|
266 | 266 | M a |
|
267 | 267 | ? a.orig |
|
268 | 268 | # Unresolved merge conflicts: |
|
269 | 269 | # |
|
270 | 270 | # a |
|
271 | 271 | # |
|
272 | 272 | # To mark files as resolved: hg resolve --mark FILE |
|
273 | 273 | |
|
274 | 274 | $ cat a |
|
275 | 275 | <<<<<<< working copy: 6efa171f091b - test: 3 |
|
276 | 276 | three |
|
277 | 277 | dirty |
|
278 | 278 | ||||||| base |
|
279 | 279 | three |
|
280 | 280 | ======= |
|
281 | 281 | four |
|
282 | 282 | >>>>>>> destination: d047485b3896 b1 - test: 4 |
|
283 | 283 | $ rm a.orig |
|
284 | 284 | |
|
285 | 285 | $ echo 'update.check = noconflict' >> .hg/hgrc |
|
286 | 286 | |
|
287 | 287 | $ revtest 'none dirty cross' dirty 3 4 |
|
288 | 288 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 289 | parent=4 |
|
290 | 290 | M foo |
|
291 | 291 | |
|
292 | 292 | $ revtest 'none dirty linear' dirty 1 2 |
|
293 | 293 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
294 | 294 | parent=2 |
|
295 | 295 | M foo |
|
296 | 296 | |
|
297 | 297 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
298 | 298 | abort: uncommitted changes |
|
299 | 299 | parent=1 |
|
300 | 300 | M foo |
|
301 | 301 | |
|
302 | 302 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
303 | 303 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
304 | 304 | parent=2 |
|
305 | 305 | |
|
306 | 306 | Locally added file is allowed |
|
307 | 307 | $ hg up -qC 3 |
|
308 | 308 | $ echo a > bar |
|
309 | 309 | $ hg add bar |
|
310 | 310 | $ hg up -q 4 |
|
311 | 311 | $ hg st |
|
312 | 312 | A bar |
|
313 | 313 | $ hg forget bar |
|
314 | 314 | $ rm bar |
|
315 | 315 | |
|
316 | 316 | Locally removed file is allowed |
|
317 | 317 | $ hg up -qC 3 |
|
318 | 318 | $ hg rm foo |
|
319 | 319 | $ hg up -q 4 |
|
320 | 320 | |
|
321 | 321 | File conflict is not allowed |
|
322 | 322 | $ hg up -qC 3 |
|
323 | 323 | $ echo dirty >> a |
|
324 | 324 | $ hg up -q 4 |
|
325 | 325 | abort: conflicting changes |
|
326 | 326 | (commit or update --clean to discard changes) |
|
327 | 327 | [255] |
|
328 | 328 | $ hg up -m 4 |
|
329 | 329 | merging a |
|
330 | 330 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
331 | 331 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
332 | 332 | use 'hg resolve' to retry unresolved file merges |
|
333 | 333 | [1] |
|
334 | 334 | $ rm a.orig |
|
335 | 335 | $ hg status |
|
336 | 336 | M a |
|
337 | 337 | # Unresolved merge conflicts: |
|
338 | 338 | # |
|
339 | 339 | # a |
|
340 | 340 | # |
|
341 | 341 | # To mark files as resolved: hg resolve --mark FILE |
|
342 | 342 | |
|
343 | 343 | $ hg resolve -l |
|
344 | 344 | U a |
|
345 | 345 | |
|
346 | Try to make empty commit while there are conflicts | |
|
347 | $ hg revert -r . a | |
|
348 | $ rm a.orig | |
|
349 | $ hg ci -m empty | |
|
350 | nothing changed | |
|
351 | [1] | |
|
352 | $ hg resolve -m a | |
|
353 | (no more unresolved files) | |
|
354 | $ hg resolve -l | |
|
355 | R a | |
|
356 | $ hg ci -m empty | |
|
357 | nothing changed | |
|
358 | [1] | |
|
359 | $ hg resolve -l | |
|
360 | R a | |
|
361 | ||
|
346 | 362 | Change/delete conflict is not allowed |
|
347 | 363 | $ hg up -qC 3 |
|
348 | 364 | $ hg rm foo |
|
349 | 365 | $ hg up -q 4 |
|
350 | 366 | |
|
351 | 367 | Uses default value of "linear" when value is misspelled |
|
352 | 368 | $ echo 'update.check = linyar' >> .hg/hgrc |
|
353 | 369 | |
|
354 | 370 | $ revtest 'dirty cross' dirty 3 4 |
|
355 | 371 | abort: uncommitted changes |
|
356 | 372 | (commit or update --clean to discard changes) |
|
357 | 373 | parent=3 |
|
358 | 374 | M foo |
|
359 | 375 | |
|
360 | 376 | Setup for later tests |
|
361 | 377 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
362 | 378 | abort: uncommitted changes |
|
363 | 379 | parent=1 |
|
364 | 380 | M foo |
|
365 | 381 | |
|
366 | 382 | $ cd .. |
|
367 | 383 | |
|
368 | 384 | Test updating to null revision |
|
369 | 385 | |
|
370 | 386 | $ hg init null-repo |
|
371 | 387 | $ cd null-repo |
|
372 | 388 | $ echo a > a |
|
373 | 389 | $ hg add a |
|
374 | 390 | $ hg ci -m a |
|
375 | 391 | $ hg up -qC 0 |
|
376 | 392 | $ echo b > b |
|
377 | 393 | $ hg add b |
|
378 | 394 | $ hg up null |
|
379 | 395 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
380 | 396 | $ hg st |
|
381 | 397 | A b |
|
382 | 398 | $ hg up -q 0 |
|
383 | 399 | $ hg st |
|
384 | 400 | A b |
|
385 | 401 | $ hg up -qC null |
|
386 | 402 | $ hg st |
|
387 | 403 | ? b |
|
388 | 404 | $ cd .. |
|
389 | 405 | |
|
390 | 406 | Test updating with closed head |
|
391 | 407 | --------------------------------------------------------------------- |
|
392 | 408 | |
|
393 | 409 | $ hg clone -U -q b1 closed-heads |
|
394 | 410 | $ cd closed-heads |
|
395 | 411 | |
|
396 | 412 | Test updating if at least one non-closed branch head exists |
|
397 | 413 | |
|
398 | 414 | if on the closed branch head: |
|
399 | 415 | - update to "." |
|
400 | 416 | - "updated to a closed branch head ...." message is displayed |
|
401 | 417 | - "N other heads for ...." message is displayed |
|
402 | 418 | |
|
403 | 419 | $ hg update -q -C 3 |
|
404 | 420 | $ hg commit --close-branch -m 6 |
|
405 | 421 | $ norevtest "on closed branch head" clean 6 |
|
406 | 422 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 423 | no open descendant heads on branch "default", updating to a closed head |
|
408 | 424 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
409 | 425 | parent=6 |
|
410 | 426 | |
|
411 | 427 | if descendant non-closed branch head exists, and it is only one branch head: |
|
412 | 428 | - update to it, even if its revision is less than closed one |
|
413 | 429 | - "N other heads for ...." message isn't displayed |
|
414 | 430 | |
|
415 | 431 | $ norevtest "non-closed 2 should be chosen" clean 1 |
|
416 | 432 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
417 | 433 | parent=2 |
|
418 | 434 | |
|
419 | 435 | if all descendant branch heads are closed, but there is another branch head: |
|
420 | 436 | - update to the tipmost descendant head |
|
421 | 437 | - "updated to a closed branch head ...." message is displayed |
|
422 | 438 | - "N other heads for ...." message is displayed |
|
423 | 439 | |
|
424 | 440 | $ norevtest "all descendant branch heads are closed" clean 3 |
|
425 | 441 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
426 | 442 | no open descendant heads on branch "default", updating to a closed head |
|
427 | 443 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
428 | 444 | parent=6 |
|
429 | 445 | |
|
430 | 446 | Test updating if all branch heads are closed |
|
431 | 447 | |
|
432 | 448 | if on the closed branch head: |
|
433 | 449 | - update to "." |
|
434 | 450 | - "updated to a closed branch head ...." message is displayed |
|
435 | 451 | - "all heads of branch ...." message is displayed |
|
436 | 452 | |
|
437 | 453 | $ hg update -q -C 2 |
|
438 | 454 | $ hg commit --close-branch -m 7 |
|
439 | 455 | $ norevtest "all heads of branch default are closed" clean 6 |
|
440 | 456 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
441 | 457 | no open descendant heads on branch "default", updating to a closed head |
|
442 | 458 | (committing will reopen branch "default") |
|
443 | 459 | parent=6 |
|
444 | 460 | |
|
445 | 461 | if not on the closed branch head: |
|
446 | 462 | - update to the tipmost descendant (closed) head |
|
447 | 463 | - "updated to a closed branch head ...." message is displayed |
|
448 | 464 | - "all heads of branch ...." message is displayed |
|
449 | 465 | |
|
450 | 466 | $ norevtest "all heads of branch default are closed" clean 1 |
|
451 | 467 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
452 | 468 | no open descendant heads on branch "default", updating to a closed head |
|
453 | 469 | (committing will reopen branch "default") |
|
454 | 470 | parent=7 |
|
455 | 471 | |
|
456 | 472 | $ cd .. |
|
457 | 473 | |
|
458 | 474 | Test updating if "default" branch doesn't exist and no revision is |
|
459 | 475 | checked out (= "default" is used as current branch) |
|
460 | 476 | |
|
461 | 477 | $ hg init no-default-branch |
|
462 | 478 | $ cd no-default-branch |
|
463 | 479 | |
|
464 | 480 | $ hg branch foobar |
|
465 | 481 | marked working directory as branch foobar |
|
466 | 482 | (branches are permanent and global, did you want a bookmark?) |
|
467 | 483 | $ echo a > a |
|
468 | 484 | $ hg commit -m "#0" -A |
|
469 | 485 | adding a |
|
470 | 486 | $ echo 1 >> a |
|
471 | 487 | $ hg commit -m "#1" |
|
472 | 488 | $ hg update -q 0 |
|
473 | 489 | $ echo 3 >> a |
|
474 | 490 | $ hg commit -m "#2" |
|
475 | 491 | created new head |
|
476 | 492 | $ hg commit --close-branch -m "#3" |
|
477 | 493 | |
|
478 | 494 | if there is at least one non-closed branch head: |
|
479 | 495 | - update to the tipmost branch head |
|
480 | 496 | |
|
481 | 497 | $ norevtest "non-closed 1 should be chosen" clean null |
|
482 | 498 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
483 | 499 | parent=1 |
|
484 | 500 | |
|
485 | 501 | if all branch heads are closed |
|
486 | 502 | - update to "tip" |
|
487 | 503 | - "updated to a closed branch head ...." message is displayed |
|
488 | 504 | - "all heads for branch "XXXX" are closed" message is displayed |
|
489 | 505 | |
|
490 | 506 | $ hg update -q -C 1 |
|
491 | 507 | $ hg commit --close-branch -m "#4" |
|
492 | 508 | |
|
493 | 509 | $ norevtest "all branches are closed" clean null |
|
494 | 510 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
495 | 511 | no open descendant heads on branch "foobar", updating to a closed head |
|
496 | 512 | (committing will reopen branch "foobar") |
|
497 | 513 | parent=4 |
|
498 | 514 | |
|
499 | 515 | $ cd ../b1 |
|
500 | 516 | |
|
501 | 517 | Test obsolescence behavior |
|
502 | 518 | --------------------------------------------------------------------- |
|
503 | 519 | |
|
504 | 520 | successors should be taken in account when checking head destination |
|
505 | 521 | |
|
506 | 522 | $ cat << EOF >> $HGRCPATH |
|
507 | 523 | > [ui] |
|
508 | 524 | > logtemplate={rev}:{node|short} {desc|firstline} |
|
509 | 525 | > [experimental] |
|
510 | 526 | > evolution.createmarkers=True |
|
511 | 527 | > EOF |
|
512 | 528 | |
|
513 | 529 | Test no-argument update to a successor of an obsoleted changeset |
|
514 | 530 | |
|
515 | 531 | $ hg log -G |
|
516 | 532 | o 5:ff252e8273df 5 |
|
517 | 533 | | |
|
518 | 534 | o 4:d047485b3896 4 |
|
519 | 535 | | |
|
520 | 536 | | o 3:6efa171f091b 3 |
|
521 | 537 | | | |
|
522 | 538 | | | o 2:bd10386d478c 2 |
|
523 | 539 | | |/ |
|
524 | 540 | | @ 1:0786582aa4b1 1 |
|
525 | 541 | |/ |
|
526 | 542 | o 0:60829823a42a 0 |
|
527 | 543 | |
|
528 | 544 | $ hg book bm -r 3 |
|
529 | 545 | $ hg status |
|
530 | 546 | M foo |
|
531 | 547 | |
|
532 | 548 | We add simple obsolescence marker between 3 and 4 (indirect successors) |
|
533 | 549 | |
|
534 | 550 | $ hg id --debug -i -r 3 |
|
535 | 551 | 6efa171f091b00a3c35edc15d48c52a498929953 |
|
536 | 552 | $ hg id --debug -i -r 4 |
|
537 | 553 | d047485b3896813b2a624e86201983520f003206 |
|
538 | 554 | $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|
539 | 555 | 1 new obsolescence markers |
|
540 | 556 | obsoleted 1 changesets |
|
541 | 557 | $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206 |
|
542 | 558 | 1 new obsolescence markers |
|
543 | 559 | |
|
544 | 560 | Test that 5 is detected as a valid destination from 3 and also accepts moving |
|
545 | 561 | the bookmark (issue4015) |
|
546 | 562 | |
|
547 | 563 | $ hg up --quiet --hidden 3 |
|
548 | 564 | $ hg up 5 |
|
549 | 565 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
550 | 566 | $ hg book bm |
|
551 | 567 | moving bookmark 'bm' forward from 6efa171f091b |
|
552 | 568 | $ hg bookmarks |
|
553 | 569 | * bm 5:ff252e8273df |
|
554 | 570 | |
|
555 | 571 | Test that we abort before we warn about the hidden commit if the working |
|
556 | 572 | directory is dirty |
|
557 | 573 | $ echo conflict > a |
|
558 | 574 | $ hg up --hidden 3 |
|
559 | 575 | abort: uncommitted changes |
|
560 | 576 | (commit or update --clean to discard changes) |
|
561 | 577 | [255] |
|
562 | 578 | |
|
563 | 579 | Test that we still warn also when there are conflicts |
|
564 | 580 | $ hg up -m --hidden 3 |
|
565 | 581 | merging a |
|
566 | 582 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
567 | 583 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
568 | 584 | use 'hg resolve' to retry unresolved file merges |
|
569 | 585 | (leaving bookmark bm) |
|
570 | 586 | updated to hidden changeset 6efa171f091b |
|
571 | 587 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
572 | 588 | [1] |
|
573 | 589 | |
|
574 | 590 | Test that statuses are reported properly before and after merge resolution. |
|
575 | 591 | $ rm a.orig |
|
576 | 592 | $ hg resolve -l |
|
577 | 593 | U a |
|
578 | 594 | $ hg status |
|
579 | 595 | M a |
|
580 | 596 | M foo |
|
581 | 597 | # Unresolved merge conflicts: |
|
582 | 598 | # |
|
583 | 599 | # a |
|
584 | 600 | # |
|
585 | 601 | # To mark files as resolved: hg resolve --mark FILE |
|
586 | 602 | |
|
587 | 603 | |
|
588 | 604 | $ hg revert -r . a |
|
589 | 605 | |
|
590 | 606 | $ rm a.orig |
|
591 | 607 | $ hg resolve -l |
|
592 | 608 | U a |
|
593 | 609 | $ hg status |
|
594 | 610 | M foo |
|
595 | 611 | # Unresolved merge conflicts: |
|
596 | 612 | # |
|
597 | 613 | # a |
|
598 | 614 | # |
|
599 | 615 | # To mark files as resolved: hg resolve --mark FILE |
|
600 | 616 | |
|
601 | 617 | $ hg status -Tjson |
|
602 | 618 | [ |
|
603 | 619 | { |
|
604 | 620 | "itemtype": "file", |
|
605 | 621 | "path": "foo", |
|
606 | 622 | "status": "M" |
|
607 | 623 | }, |
|
608 | 624 | { |
|
609 | 625 | "itemtype": "file", |
|
610 | 626 | "path": "a", |
|
611 | 627 | "unresolved": true |
|
612 | 628 | } |
|
613 | 629 | ] |
|
614 | 630 | |
|
615 | 631 | $ hg resolve -m |
|
616 | 632 | (no more unresolved files) |
|
617 | 633 | |
|
618 | 634 | $ hg resolve -l |
|
619 | 635 | R a |
|
620 | 636 | $ hg status |
|
621 | 637 | M foo |
|
622 | 638 | # No unresolved merge conflicts. |
|
623 | 639 | |
|
624 | 640 | $ hg status -Tjson |
|
625 | 641 | [ |
|
626 | 642 | { |
|
627 | 643 | "itemtype": "file", |
|
628 | 644 | "path": "foo", |
|
629 | 645 | "status": "M" |
|
630 | 646 | } |
|
631 | 647 | ] |
|
632 | 648 | |
|
633 | 649 | Test that 4 is detected as the no-argument destination from 3 and also moves |
|
634 | 650 | the bookmark with it |
|
635 | 651 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
636 | 652 | $ hg status |
|
637 | 653 | M foo |
|
638 | 654 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
639 | 655 | updated to hidden changeset 6efa171f091b |
|
640 | 656 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
641 | 657 | $ hg book -f bm |
|
642 | 658 | $ hg up |
|
643 | 659 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
644 | 660 | updating bookmark bm |
|
645 | 661 | $ hg book |
|
646 | 662 | * bm 4:d047485b3896 |
|
647 | 663 | |
|
648 | 664 | Test that 5 is detected as a valid destination from 1 |
|
649 | 665 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
650 | 666 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
651 | 667 | updated to hidden changeset 6efa171f091b |
|
652 | 668 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
653 | 669 | $ hg up 5 |
|
654 | 670 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
655 | 671 | |
|
656 | 672 | Test that 5 is not detected as a valid destination from 2 |
|
657 | 673 | $ hg up --quiet 0 |
|
658 | 674 | $ hg up --quiet 2 |
|
659 | 675 | $ hg up 5 |
|
660 | 676 | abort: uncommitted changes |
|
661 | 677 | (commit or update --clean to discard changes) |
|
662 | 678 | [255] |
|
663 | 679 | |
|
664 | 680 | Test that we don't crash when updating from a pruned changeset (i.e. has no |
|
665 | 681 | successors). Behavior should probably be that we update to the first |
|
666 | 682 | non-obsolete parent but that will be decided later. |
|
667 | 683 | $ hg id --debug -r 2 |
|
668 | 684 | bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
669 | 685 | $ hg up --quiet 0 |
|
670 | 686 | $ hg up --quiet 2 |
|
671 | 687 | $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
672 | 688 | 1 new obsolescence markers |
|
673 | 689 | obsoleted 1 changesets |
|
674 | 690 | $ hg up |
|
675 | 691 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
676 | 692 | |
|
677 | 693 | Test experimental revset support |
|
678 | 694 | |
|
679 | 695 | $ hg log -r '_destupdate()' |
|
680 | 696 | 2:bd10386d478c 2 (no-eol) |
|
681 | 697 | |
|
682 | 698 | Test that boolean flags allow --no-flag specification to override [defaults] |
|
683 | 699 | $ cat >> $HGRCPATH <<EOF |
|
684 | 700 | > [defaults] |
|
685 | 701 | > update = --check |
|
686 | 702 | > EOF |
|
687 | 703 | $ hg co 2 |
|
688 | 704 | abort: uncommitted changes |
|
689 | 705 | [255] |
|
690 | 706 | $ hg co --no-check 2 |
|
691 | 707 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now