Show More
@@ -1,706 +1,711 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 | [10] |
|
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 |
$ revtest '- |
|
|
161 | $ revtest '--clean dirty linear' dirty 1 2 --clean | |
|
162 | 162 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 163 | parent=2 |
|
164 | 164 | |
|
165 | $ revtest '-c dirty linear' dirty 1 2 -c | |
|
165 | $ revtest '--check dirty linear' dirty 1 2 --check | |
|
166 | 166 | abort: uncommitted changes |
|
167 | 167 | parent=1 |
|
168 | 168 | M foo |
|
169 | 169 | |
|
170 | $ revtest '-m dirty linear' dirty 1 2 -m | |
|
170 | $ revtest '--merge dirty linear' dirty 1 2 --merge | |
|
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 | $ revtest '-m dirty cross' dirty 3 4 -m | |
|
175 | $ revtest '--merge dirty cross' dirty 3 4 --merge | |
|
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 | $ revtest '-c dirtysub linear' dirtysub 1 2 -c | |
|
180 | $ revtest '--check dirtysub linear' dirtysub 1 2 --check | |
|
181 | 181 | abort: uncommitted changes in subrepository "sub" |
|
182 | 182 | parent=1 |
|
183 | 183 | M sub/suba |
|
184 | 184 | |
|
185 | $ norevtest '-c clean same' clean 2 -c | |
|
185 | $ norevtest '--check 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 |
$ revtest '- |
|
|
191 | $ revtest '--check --clean dirty linear' dirty 1 2 "--check --clean" | |
|
192 | 192 | abort: cannot specify both --clean and --check |
|
193 | 193 | parent=1 |
|
194 | 194 | M foo |
|
195 | 195 | |
|
196 |
$ revtest '- |
|
|
196 | $ revtest '--merge -checkc dirty linear' dirty 1 2 "--merge --check" | |
|
197 | 197 | abort: cannot specify both --check and --merge |
|
198 | 198 | parent=1 |
|
199 | 199 | M foo |
|
200 | 200 | |
|
201 |
$ revtest '- |
|
|
201 | $ revtest '--merge -clean dirty linear' dirty 1 2 "--merge --clean" | |
|
202 | 202 | abort: cannot specify both --clean and --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 | $ revtest 'none dirty linear' dirty 1 2 -c | |
|
214 | $ revtest 'none dirty linear' dirty 1 2 --check | |
|
215 | 215 | abort: uncommitted changes |
|
216 | 216 | parent=1 |
|
217 | 217 | M foo |
|
218 | 218 | |
|
219 |
$ revtest 'none dirty linear' dirty 1 2 - |
|
|
219 | $ revtest '--merge none dirty linear' dirty 1 2 --check | |
|
220 | abort: uncommitted changes | |
|
221 | parent=1 | |
|
222 | M foo | |
|
223 | ||
|
224 | $ revtest 'none dirty linear' dirty 1 2 --clean | |
|
220 | 225 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 226 | parent=2 |
|
222 | 227 | |
|
223 | 228 | $ echo 'update.check = none' >> .hg/hgrc |
|
224 | 229 | |
|
225 | 230 | $ revtest 'none dirty cross' dirty 3 4 |
|
226 | 231 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 232 | parent=4 |
|
228 | 233 | M foo |
|
229 | 234 | |
|
230 | 235 | $ revtest 'none dirty linear' dirty 1 2 |
|
231 | 236 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 237 | parent=2 |
|
233 | 238 | M foo |
|
234 | 239 | |
|
235 | $ revtest 'none dirty linear' dirty 1 2 -c | |
|
240 | $ revtest 'none dirty linear' dirty 1 2 --check | |
|
236 | 241 | abort: uncommitted changes |
|
237 | 242 | parent=1 |
|
238 | 243 | M foo |
|
239 | 244 | |
|
240 |
$ revtest 'none dirty linear' dirty 1 2 - |
|
|
245 | $ revtest 'none dirty linear' dirty 1 2 --clean | |
|
241 | 246 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
242 | 247 | parent=2 |
|
243 | 248 | |
|
244 | 249 | $ hg co -qC 3 |
|
245 | 250 | $ echo dirty >> a |
|
246 | 251 | $ hg co --tool :merge3 4 |
|
247 | 252 | merging a |
|
248 | 253 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
249 | 254 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
250 | 255 | use 'hg resolve' to retry unresolved file merges |
|
251 | 256 | [1] |
|
252 | 257 | $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n' |
|
253 | 258 | o 5:ff252e8273df b1 |
|
254 | 259 | | |
|
255 | 260 | @ 4:d047485b3896 0:60829823a42a b1 |
|
256 | 261 | | |
|
257 | 262 | | % 3:6efa171f091b 1:0786582aa4b1 |
|
258 | 263 | | | |
|
259 | 264 | | | o 2:bd10386d478c |
|
260 | 265 | | |/ |
|
261 | 266 | | o 1:0786582aa4b1 |
|
262 | 267 | |/ |
|
263 | 268 | o 0:60829823a42a |
|
264 | 269 | |
|
265 | 270 | $ hg st |
|
266 | 271 | M a |
|
267 | 272 | ? a.orig |
|
268 | 273 | # Unresolved merge conflicts: |
|
269 | 274 | # |
|
270 | 275 | # a |
|
271 | 276 | # |
|
272 | 277 | # To mark files as resolved: hg resolve --mark FILE |
|
273 | 278 | |
|
274 | 279 | $ cat a |
|
275 | 280 | <<<<<<< working copy: 6efa171f091b - test: 3 |
|
276 | 281 | three |
|
277 | 282 | dirty |
|
278 | 283 | ||||||| base |
|
279 | 284 | three |
|
280 | 285 | ======= |
|
281 | 286 | four |
|
282 | 287 | >>>>>>> destination: d047485b3896 b1 - test: 4 |
|
283 | 288 | $ rm a.orig |
|
284 | 289 | |
|
285 | 290 | $ echo 'update.check = noconflict' >> .hg/hgrc |
|
286 | 291 | |
|
287 | 292 | $ revtest 'none dirty cross' dirty 3 4 |
|
288 | 293 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 294 | parent=4 |
|
290 | 295 | M foo |
|
291 | 296 | |
|
292 | 297 | $ revtest 'none dirty linear' dirty 1 2 |
|
293 | 298 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
294 | 299 | parent=2 |
|
295 | 300 | M foo |
|
296 | 301 | |
|
297 | 302 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
298 | 303 | abort: uncommitted changes |
|
299 | 304 | parent=1 |
|
300 | 305 | M foo |
|
301 | 306 | |
|
302 | 307 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
303 | 308 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
304 | 309 | parent=2 |
|
305 | 310 | |
|
306 | 311 | Locally added file is allowed |
|
307 | 312 | $ hg up -qC 3 |
|
308 | 313 | $ echo a > bar |
|
309 | 314 | $ hg add bar |
|
310 | 315 | $ hg up -q 4 |
|
311 | 316 | $ hg st |
|
312 | 317 | A bar |
|
313 | 318 | $ hg forget bar |
|
314 | 319 | $ rm bar |
|
315 | 320 | |
|
316 | 321 | Locally removed file is allowed |
|
317 | 322 | $ hg up -qC 3 |
|
318 | 323 | $ hg rm foo |
|
319 | 324 | $ hg up -q 4 |
|
320 | 325 | |
|
321 | 326 | File conflict is not allowed |
|
322 | 327 | $ hg up -qC 3 |
|
323 | 328 | $ echo dirty >> a |
|
324 | 329 | $ hg up -q 4 |
|
325 | 330 | abort: conflicting changes |
|
326 | 331 | (commit or update --clean to discard changes) |
|
327 | 332 | [20] |
|
328 | 333 | $ hg up -m 4 |
|
329 | 334 | merging a |
|
330 | 335 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
331 | 336 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
332 | 337 | use 'hg resolve' to retry unresolved file merges |
|
333 | 338 | [1] |
|
334 | 339 | $ rm a.orig |
|
335 | 340 | $ hg status |
|
336 | 341 | M a |
|
337 | 342 | # Unresolved merge conflicts: |
|
338 | 343 | # |
|
339 | 344 | # a |
|
340 | 345 | # |
|
341 | 346 | # To mark files as resolved: hg resolve --mark FILE |
|
342 | 347 | |
|
343 | 348 | $ hg resolve -l |
|
344 | 349 | U a |
|
345 | 350 | |
|
346 | 351 | Try to make empty commit while there are conflicts |
|
347 | 352 | $ hg revert -r . a |
|
348 | 353 | $ rm a.orig |
|
349 | 354 | $ hg ci -m empty |
|
350 | 355 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
351 | 356 | [20] |
|
352 | 357 | $ hg resolve -m a |
|
353 | 358 | (no more unresolved files) |
|
354 | 359 | $ hg resolve -l |
|
355 | 360 | R a |
|
356 | 361 | $ hg ci -m empty |
|
357 | 362 | nothing changed |
|
358 | 363 | [1] |
|
359 | 364 | $ hg resolve -l |
|
360 | 365 | |
|
361 | 366 | Change/delete conflict is not allowed |
|
362 | 367 | $ hg up -qC 3 |
|
363 | 368 | $ hg rm foo |
|
364 | 369 | $ hg up -q 4 |
|
365 | 370 | |
|
366 | 371 | Uses default value of "linear" when value is misspelled |
|
367 | 372 | $ echo 'update.check = linyar' >> .hg/hgrc |
|
368 | 373 | |
|
369 | 374 | $ revtest 'dirty cross' dirty 3 4 |
|
370 | 375 | abort: uncommitted changes |
|
371 | 376 | (commit or update --clean to discard changes) |
|
372 | 377 | parent=3 |
|
373 | 378 | M foo |
|
374 | 379 | |
|
375 | 380 | Setup for later tests |
|
376 | 381 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
377 | 382 | abort: uncommitted changes |
|
378 | 383 | parent=1 |
|
379 | 384 | M foo |
|
380 | 385 | |
|
381 | 386 | $ cd .. |
|
382 | 387 | |
|
383 | 388 | Test updating to null revision |
|
384 | 389 | |
|
385 | 390 | $ hg init null-repo |
|
386 | 391 | $ cd null-repo |
|
387 | 392 | $ echo a > a |
|
388 | 393 | $ hg add a |
|
389 | 394 | $ hg ci -m a |
|
390 | 395 | $ hg up -qC 0 |
|
391 | 396 | $ echo b > b |
|
392 | 397 | $ hg add b |
|
393 | 398 | $ hg up null |
|
394 | 399 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
395 | 400 | $ hg st |
|
396 | 401 | A b |
|
397 | 402 | $ hg up -q 0 |
|
398 | 403 | $ hg st |
|
399 | 404 | A b |
|
400 | 405 | $ hg up -qC null |
|
401 | 406 | $ hg st |
|
402 | 407 | ? b |
|
403 | 408 | $ cd .. |
|
404 | 409 | |
|
405 | 410 | Test updating with closed head |
|
406 | 411 | --------------------------------------------------------------------- |
|
407 | 412 | |
|
408 | 413 | $ hg clone -U -q b1 closed-heads |
|
409 | 414 | $ cd closed-heads |
|
410 | 415 | |
|
411 | 416 | Test updating if at least one non-closed branch head exists |
|
412 | 417 | |
|
413 | 418 | if on the closed branch head: |
|
414 | 419 | - update to "." |
|
415 | 420 | - "updated to a closed branch head ...." message is displayed |
|
416 | 421 | - "N other heads for ...." message is displayed |
|
417 | 422 | |
|
418 | 423 | $ hg update -q -C 3 |
|
419 | 424 | $ hg commit --close-branch -m 6 |
|
420 | 425 | $ norevtest "on closed branch head" clean 6 |
|
421 | 426 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
422 | 427 | no open descendant heads on branch "default", updating to a closed head |
|
423 | 428 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
424 | 429 | parent=6 |
|
425 | 430 | |
|
426 | 431 | if descendant non-closed branch head exists, and it is only one branch head: |
|
427 | 432 | - update to it, even if its revision is less than closed one |
|
428 | 433 | - "N other heads for ...." message isn't displayed |
|
429 | 434 | |
|
430 | 435 | $ norevtest "non-closed 2 should be chosen" clean 1 |
|
431 | 436 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
432 | 437 | parent=2 |
|
433 | 438 | |
|
434 | 439 | if all descendant branch heads are closed, but there is another branch head: |
|
435 | 440 | - update to the tipmost descendant head |
|
436 | 441 | - "updated to a closed branch head ...." message is displayed |
|
437 | 442 | - "N other heads for ...." message is displayed |
|
438 | 443 | |
|
439 | 444 | $ norevtest "all descendant branch heads are closed" clean 3 |
|
440 | 445 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
441 | 446 | no open descendant heads on branch "default", updating to a closed head |
|
442 | 447 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
443 | 448 | parent=6 |
|
444 | 449 | |
|
445 | 450 | Test updating if all branch heads are closed |
|
446 | 451 | |
|
447 | 452 | if on the closed branch head: |
|
448 | 453 | - update to "." |
|
449 | 454 | - "updated to a closed branch head ...." message is displayed |
|
450 | 455 | - "all heads of branch ...." message is displayed |
|
451 | 456 | |
|
452 | 457 | $ hg update -q -C 2 |
|
453 | 458 | $ hg commit --close-branch -m 7 |
|
454 | 459 | $ norevtest "all heads of branch default are closed" clean 6 |
|
455 | 460 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
456 | 461 | no open descendant heads on branch "default", updating to a closed head |
|
457 | 462 | (committing will reopen branch "default") |
|
458 | 463 | parent=6 |
|
459 | 464 | |
|
460 | 465 | if not on the closed branch head: |
|
461 | 466 | - update to the tipmost descendant (closed) head |
|
462 | 467 | - "updated to a closed branch head ...." message is displayed |
|
463 | 468 | - "all heads of branch ...." message is displayed |
|
464 | 469 | |
|
465 | 470 | $ norevtest "all heads of branch default are closed" clean 1 |
|
466 | 471 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
467 | 472 | no open descendant heads on branch "default", updating to a closed head |
|
468 | 473 | (committing will reopen branch "default") |
|
469 | 474 | parent=7 |
|
470 | 475 | |
|
471 | 476 | $ cd .. |
|
472 | 477 | |
|
473 | 478 | Test updating if "default" branch doesn't exist and no revision is |
|
474 | 479 | checked out (= "default" is used as current branch) |
|
475 | 480 | |
|
476 | 481 | $ hg init no-default-branch |
|
477 | 482 | $ cd no-default-branch |
|
478 | 483 | |
|
479 | 484 | $ hg branch foobar |
|
480 | 485 | marked working directory as branch foobar |
|
481 | 486 | (branches are permanent and global, did you want a bookmark?) |
|
482 | 487 | $ echo a > a |
|
483 | 488 | $ hg commit -m "#0" -A |
|
484 | 489 | adding a |
|
485 | 490 | $ echo 1 >> a |
|
486 | 491 | $ hg commit -m "#1" |
|
487 | 492 | $ hg update -q 0 |
|
488 | 493 | $ echo 3 >> a |
|
489 | 494 | $ hg commit -m "#2" |
|
490 | 495 | created new head |
|
491 | 496 | $ hg commit --close-branch -m "#3" |
|
492 | 497 | |
|
493 | 498 | if there is at least one non-closed branch head: |
|
494 | 499 | - update to the tipmost branch head |
|
495 | 500 | |
|
496 | 501 | $ norevtest "non-closed 1 should be chosen" clean null |
|
497 | 502 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
498 | 503 | parent=1 |
|
499 | 504 | |
|
500 | 505 | if all branch heads are closed |
|
501 | 506 | - update to "tip" |
|
502 | 507 | - "updated to a closed branch head ...." message is displayed |
|
503 | 508 | - "all heads for branch "XXXX" are closed" message is displayed |
|
504 | 509 | |
|
505 | 510 | $ hg update -q -C 1 |
|
506 | 511 | $ hg commit --close-branch -m "#4" |
|
507 | 512 | |
|
508 | 513 | $ norevtest "all branches are closed" clean null |
|
509 | 514 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
510 | 515 | no open descendant heads on branch "foobar", updating to a closed head |
|
511 | 516 | (committing will reopen branch "foobar") |
|
512 | 517 | parent=4 |
|
513 | 518 | |
|
514 | 519 | $ cd ../b1 |
|
515 | 520 | |
|
516 | 521 | Test obsolescence behavior |
|
517 | 522 | --------------------------------------------------------------------- |
|
518 | 523 | |
|
519 | 524 | successors should be taken in account when checking head destination |
|
520 | 525 | |
|
521 | 526 | $ cat << EOF >> $HGRCPATH |
|
522 | 527 | > [ui] |
|
523 | 528 | > logtemplate={rev}:{node|short} {desc|firstline} |
|
524 | 529 | > [experimental] |
|
525 | 530 | > evolution.createmarkers=True |
|
526 | 531 | > EOF |
|
527 | 532 | |
|
528 | 533 | Test no-argument update to a successor of an obsoleted changeset |
|
529 | 534 | |
|
530 | 535 | $ hg log -G |
|
531 | 536 | o 5:ff252e8273df 5 |
|
532 | 537 | | |
|
533 | 538 | o 4:d047485b3896 4 |
|
534 | 539 | | |
|
535 | 540 | | o 3:6efa171f091b 3 |
|
536 | 541 | | | |
|
537 | 542 | | | o 2:bd10386d478c 2 |
|
538 | 543 | | |/ |
|
539 | 544 | | @ 1:0786582aa4b1 1 |
|
540 | 545 | |/ |
|
541 | 546 | o 0:60829823a42a 0 |
|
542 | 547 | |
|
543 | 548 | $ hg book bm -r 3 |
|
544 | 549 | $ hg status |
|
545 | 550 | M foo |
|
546 | 551 | |
|
547 | 552 | We add simple obsolescence marker between 3 and 4 (indirect successors) |
|
548 | 553 | |
|
549 | 554 | $ hg id --debug -i -r 3 |
|
550 | 555 | 6efa171f091b00a3c35edc15d48c52a498929953 |
|
551 | 556 | $ hg id --debug -i -r 4 |
|
552 | 557 | d047485b3896813b2a624e86201983520f003206 |
|
553 | 558 | $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|
554 | 559 | 1 new obsolescence markers |
|
555 | 560 | obsoleted 1 changesets |
|
556 | 561 | $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206 |
|
557 | 562 | 1 new obsolescence markers |
|
558 | 563 | |
|
559 | 564 | Test that 5 is detected as a valid destination from 3 and also accepts moving |
|
560 | 565 | the bookmark (issue4015) |
|
561 | 566 | |
|
562 | 567 | $ hg up --quiet --hidden 3 |
|
563 | 568 | $ hg up 5 |
|
564 | 569 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
565 | 570 | $ hg book bm |
|
566 | 571 | moving bookmark 'bm' forward from 6efa171f091b |
|
567 | 572 | $ hg bookmarks |
|
568 | 573 | * bm 5:ff252e8273df |
|
569 | 574 | |
|
570 | 575 | Test that we abort before we warn about the hidden commit if the working |
|
571 | 576 | directory is dirty |
|
572 | 577 | $ echo conflict > a |
|
573 | 578 | $ hg up --hidden 3 |
|
574 | 579 | abort: uncommitted changes |
|
575 | 580 | (commit or update --clean to discard changes) |
|
576 | 581 | [255] |
|
577 | 582 | |
|
578 | 583 | Test that we still warn also when there are conflicts |
|
579 | 584 | $ hg up -m --hidden 3 |
|
580 | 585 | merging a |
|
581 | 586 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
582 | 587 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
583 | 588 | use 'hg resolve' to retry unresolved file merges |
|
584 | 589 | (leaving bookmark bm) |
|
585 | 590 | updated to hidden changeset 6efa171f091b |
|
586 | 591 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
587 | 592 | [1] |
|
588 | 593 | |
|
589 | 594 | Test that statuses are reported properly before and after merge resolution. |
|
590 | 595 | $ rm a.orig |
|
591 | 596 | $ hg resolve -l |
|
592 | 597 | U a |
|
593 | 598 | $ hg status |
|
594 | 599 | M a |
|
595 | 600 | M foo |
|
596 | 601 | # Unresolved merge conflicts: |
|
597 | 602 | # |
|
598 | 603 | # a |
|
599 | 604 | # |
|
600 | 605 | # To mark files as resolved: hg resolve --mark FILE |
|
601 | 606 | |
|
602 | 607 | |
|
603 | 608 | $ hg revert -r . a |
|
604 | 609 | |
|
605 | 610 | $ rm a.orig |
|
606 | 611 | $ hg resolve -l |
|
607 | 612 | U a |
|
608 | 613 | $ hg status |
|
609 | 614 | M foo |
|
610 | 615 | # Unresolved merge conflicts: |
|
611 | 616 | # |
|
612 | 617 | # a |
|
613 | 618 | # |
|
614 | 619 | # To mark files as resolved: hg resolve --mark FILE |
|
615 | 620 | |
|
616 | 621 | $ hg status -Tjson |
|
617 | 622 | [ |
|
618 | 623 | { |
|
619 | 624 | "itemtype": "file", |
|
620 | 625 | "path": "foo", |
|
621 | 626 | "status": "M" |
|
622 | 627 | }, |
|
623 | 628 | { |
|
624 | 629 | "itemtype": "file", |
|
625 | 630 | "path": "a", |
|
626 | 631 | "unresolved": true |
|
627 | 632 | } |
|
628 | 633 | ] |
|
629 | 634 | |
|
630 | 635 | $ hg resolve -m |
|
631 | 636 | (no more unresolved files) |
|
632 | 637 | |
|
633 | 638 | $ hg resolve -l |
|
634 | 639 | R a |
|
635 | 640 | $ hg status |
|
636 | 641 | M foo |
|
637 | 642 | # No unresolved merge conflicts. |
|
638 | 643 | |
|
639 | 644 | $ hg status -Tjson |
|
640 | 645 | [ |
|
641 | 646 | { |
|
642 | 647 | "itemtype": "file", |
|
643 | 648 | "path": "foo", |
|
644 | 649 | "status": "M" |
|
645 | 650 | } |
|
646 | 651 | ] |
|
647 | 652 | |
|
648 | 653 | Test that 4 is detected as the no-argument destination from 3 and also moves |
|
649 | 654 | the bookmark with it |
|
650 | 655 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
651 | 656 | $ hg status |
|
652 | 657 | M foo |
|
653 | 658 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
654 | 659 | updated to hidden changeset 6efa171f091b |
|
655 | 660 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
656 | 661 | $ hg book -f bm |
|
657 | 662 | $ hg up |
|
658 | 663 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
659 | 664 | updating bookmark bm |
|
660 | 665 | $ hg book |
|
661 | 666 | * bm 4:d047485b3896 |
|
662 | 667 | |
|
663 | 668 | Test that 5 is detected as a valid destination from 1 |
|
664 | 669 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
665 | 670 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
666 | 671 | updated to hidden changeset 6efa171f091b |
|
667 | 672 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
668 | 673 | $ hg up 5 |
|
669 | 674 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
670 | 675 | |
|
671 | 676 | Test that 5 is not detected as a valid destination from 2 |
|
672 | 677 | $ hg up --quiet 0 |
|
673 | 678 | $ hg up --quiet 2 |
|
674 | 679 | $ hg up 5 |
|
675 | 680 | abort: uncommitted changes |
|
676 | 681 | (commit or update --clean to discard changes) |
|
677 | 682 | [255] |
|
678 | 683 | |
|
679 | 684 | Test that we don't crash when updating from a pruned changeset (i.e. has no |
|
680 | 685 | successors). Behavior should probably be that we update to the first |
|
681 | 686 | non-obsolete parent but that will be decided later. |
|
682 | 687 | $ hg id --debug -r 2 |
|
683 | 688 | bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
684 | 689 | $ hg up --quiet 0 |
|
685 | 690 | $ hg up --quiet 2 |
|
686 | 691 | $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
687 | 692 | 1 new obsolescence markers |
|
688 | 693 | obsoleted 1 changesets |
|
689 | 694 | $ hg up |
|
690 | 695 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
691 | 696 | |
|
692 | 697 | Test experimental revset support |
|
693 | 698 | |
|
694 | 699 | $ hg log -r '_destupdate()' |
|
695 | 700 | 2:bd10386d478c 2 (no-eol) |
|
696 | 701 | |
|
697 | 702 | Test that boolean flags allow --no-flag specification to override [defaults] |
|
698 | 703 | $ cat >> $HGRCPATH <<EOF |
|
699 | 704 | > [defaults] |
|
700 | 705 | > update = --check |
|
701 | 706 | > EOF |
|
702 | 707 | $ hg co 2 |
|
703 | 708 | abort: uncommitted changes |
|
704 | 709 | [20] |
|
705 | 710 | $ hg co --no-check 2 |
|
706 | 711 | 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