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