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