Show More
@@ -1,424 +1,429 b'' | |||
|
1 | 1 | $ cat <<EOF > merge |
|
2 | 2 | > from __future__ import print_function |
|
3 | 3 | > import sys, os |
|
4 | 4 | > |
|
5 | 5 | > try: |
|
6 | 6 | > import msvcrt |
|
7 | 7 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
8 | 8 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
9 | 9 | > except ImportError: |
|
10 | 10 | > pass |
|
11 | 11 | > |
|
12 | 12 | > print("merging for", os.path.basename(sys.argv[1])) |
|
13 | 13 | > EOF |
|
14 | 14 | $ HGMERGE="$PYTHON ../merge"; export HGMERGE |
|
15 | 15 | |
|
16 | 16 | $ hg init t |
|
17 | 17 | $ cd t |
|
18 | 18 | $ echo This is file a1 > a |
|
19 | 19 | $ hg add a |
|
20 | 20 | $ hg commit -m "commit #0" |
|
21 | 21 | $ echo This is file b1 > b |
|
22 | 22 | $ hg add b |
|
23 | 23 | $ hg commit -m "commit #1" |
|
24 | 24 | |
|
25 | 25 | $ hg update 0 |
|
26 | 26 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
27 | 27 | |
|
28 | 28 | Test interrupted updates by having a non-empty dir with the same name as one |
|
29 | 29 | of the files in a commit we're updating to |
|
30 | 30 | |
|
31 | 31 | $ mkdir b && touch b/nonempty |
|
32 | 32 | $ hg up |
|
33 | 33 | abort: *: '$TESTTMP/t/b' (glob) |
|
34 | 34 | [255] |
|
35 | 35 | $ hg ci |
|
36 | 36 | abort: last update was interrupted |
|
37 | 37 | (use 'hg update' to get a consistent checkout) |
|
38 | 38 | [255] |
|
39 | 39 | $ hg sum |
|
40 | 40 | parent: 0:538afb845929 |
|
41 | 41 | commit #0 |
|
42 | 42 | branch: default |
|
43 | 43 | commit: 1 unknown (interrupted update) |
|
44 | 44 | update: 1 new changesets (update) |
|
45 | 45 | phases: 2 draft |
|
46 | 46 | $ rm b/nonempty |
|
47 | 47 | $ hg up |
|
48 | 48 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
49 | 49 | $ hg sum |
|
50 | 50 | parent: 1:b8bb4a988f25 tip |
|
51 | 51 | commit #1 |
|
52 | 52 | branch: default |
|
53 | 53 | commit: (clean) |
|
54 | 54 | update: (current) |
|
55 | 55 | phases: 2 draft |
|
56 | 56 | |
|
57 | 57 | Prepare a basic merge |
|
58 | 58 | |
|
59 | 59 | $ hg up 0 |
|
60 | 60 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
61 | 61 | $ echo This is file c1 > c |
|
62 | 62 | $ hg add c |
|
63 | 63 | $ hg commit -m "commit #2" |
|
64 | 64 | created new head |
|
65 | 65 | $ echo This is file b1 > b |
|
66 | 66 | no merges expected |
|
67 | 67 | $ hg merge -P 1 |
|
68 | 68 | changeset: 1:b8bb4a988f25 |
|
69 | 69 | user: test |
|
70 | 70 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
71 | 71 | summary: commit #1 |
|
72 | 72 | |
|
73 | 73 | $ hg merge 1 |
|
74 | 74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 75 | (branch merge, don't forget to commit) |
|
76 | 76 | $ hg diff --nodates |
|
77 | 77 | diff -r 49035e18a8e6 b |
|
78 | 78 | --- /dev/null |
|
79 | 79 | +++ b/b |
|
80 | 80 | @@ -0,0 +1,1 @@ |
|
81 | 81 | +This is file b1 |
|
82 | 82 | $ hg status |
|
83 | 83 | M b |
|
84 | 84 | $ cd ..; rm -r t |
|
85 | 85 | |
|
86 | 86 | $ hg init t |
|
87 | 87 | $ cd t |
|
88 | 88 | $ echo This is file a1 > a |
|
89 | 89 | $ hg add a |
|
90 | 90 | $ hg commit -m "commit #0" |
|
91 | 91 | $ echo This is file b1 > b |
|
92 | 92 | $ hg add b |
|
93 | 93 | $ hg commit -m "commit #1" |
|
94 | 94 | |
|
95 | 95 | $ hg update 0 |
|
96 | 96 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
97 | 97 | $ echo This is file c1 > c |
|
98 | 98 | $ hg add c |
|
99 | 99 | $ hg commit -m "commit #2" |
|
100 | 100 | created new head |
|
101 | 101 | $ echo This is file b2 > b |
|
102 | 102 | merge should fail |
|
103 | 103 | $ hg merge 1 |
|
104 | 104 | b: untracked file differs |
|
105 | 105 | abort: untracked files in working directory differ from files in requested revision |
|
106 | 106 | [255] |
|
107 | 107 | |
|
108 | 108 | #if symlink |
|
109 | 109 | symlinks to directories should be treated as regular files (issue5027) |
|
110 | 110 | $ rm b |
|
111 | 111 | $ ln -s 'This is file b2' b |
|
112 | 112 | $ hg merge 1 |
|
113 | 113 | b: untracked file differs |
|
114 | 114 | abort: untracked files in working directory differ from files in requested revision |
|
115 | 115 | [255] |
|
116 | 116 | symlinks shouldn't be followed |
|
117 | 117 | $ rm b |
|
118 | 118 | $ echo This is file b1 > .hg/b |
|
119 | 119 | $ ln -s .hg/b b |
|
120 | 120 | $ hg merge 1 |
|
121 | 121 | b: untracked file differs |
|
122 | 122 | abort: untracked files in working directory differ from files in requested revision |
|
123 | 123 | [255] |
|
124 | 124 | |
|
125 | 125 | $ rm b |
|
126 | 126 | $ echo This is file b2 > b |
|
127 | 127 | #endif |
|
128 | 128 | |
|
129 | 129 | bad config |
|
130 | 130 | $ hg merge 1 --config merge.checkunknown=x |
|
131 | 131 | abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') |
|
132 | 132 | [255] |
|
133 | 133 | this merge should fail |
|
134 | 134 | $ hg merge 1 --config merge.checkunknown=abort |
|
135 | 135 | b: untracked file differs |
|
136 | 136 | abort: untracked files in working directory differ from files in requested revision |
|
137 | 137 | [255] |
|
138 | 138 | |
|
139 | 139 | this merge should warn |
|
140 | 140 | $ hg merge 1 --config merge.checkunknown=warn |
|
141 | 141 | b: replacing untracked file |
|
142 | 142 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
143 | 143 | (branch merge, don't forget to commit) |
|
144 | 144 | $ cat b.orig |
|
145 | 145 | This is file b2 |
|
146 | 146 | $ hg up --clean 2 |
|
147 | 147 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
148 | 148 | $ mv b.orig b |
|
149 | 149 | |
|
150 | 150 | this merge should silently ignore |
|
151 | 151 | $ cat b |
|
152 | 152 | This is file b2 |
|
153 | 153 | $ hg merge 1 --config merge.checkunknown=ignore |
|
154 | 154 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
155 | 155 | (branch merge, don't forget to commit) |
|
156 | 156 | |
|
157 | 157 | merge.checkignored |
|
158 | 158 | $ hg up --clean 1 |
|
159 | 159 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
160 | 160 | $ cat >> .hgignore << EOF |
|
161 | 161 | > remoteignored |
|
162 | 162 | > EOF |
|
163 | 163 | $ echo This is file localignored3 > localignored |
|
164 | 164 | $ echo This is file remoteignored3 > remoteignored |
|
165 | 165 | $ hg add .hgignore localignored remoteignored |
|
166 | 166 | $ hg commit -m "commit #3" |
|
167 | 167 | |
|
168 | 168 | $ hg up 2 |
|
169 | 169 | 1 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
170 | 170 | $ cat >> .hgignore << EOF |
|
171 | 171 | > localignored |
|
172 | 172 | > EOF |
|
173 | 173 | $ hg add .hgignore |
|
174 | 174 | $ hg commit -m "commit #4" |
|
175 | 175 | |
|
176 | 176 | remote .hgignore shouldn't be used for determining whether a file is ignored |
|
177 | 177 | $ echo This is file remoteignored4 > remoteignored |
|
178 | 178 | $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort |
|
179 | 179 | remoteignored: untracked file differs |
|
180 | 180 | abort: untracked files in working directory differ from files in requested revision |
|
181 | 181 | [255] |
|
182 | 182 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore |
|
183 | 183 | merging .hgignore |
|
184 | 184 | merging for .hgignore |
|
185 | 185 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
186 | 186 | (branch merge, don't forget to commit) |
|
187 | 187 | $ cat remoteignored |
|
188 | 188 | This is file remoteignored3 |
|
189 | 189 | $ cat remoteignored.orig |
|
190 | 190 | This is file remoteignored4 |
|
191 | 191 | $ rm remoteignored.orig |
|
192 | 192 | |
|
193 | 193 | local .hgignore should be used for that |
|
194 | 194 | $ hg up --clean 4 |
|
195 | 195 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
196 | 196 | $ echo This is file localignored4 > localignored |
|
197 | 197 | also test other conflicting files to see we output the full set of warnings |
|
198 | 198 | $ echo This is file b2 > b |
|
199 | 199 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort |
|
200 | 200 | b: untracked file differs |
|
201 | 201 | localignored: untracked file differs |
|
202 | 202 | abort: untracked files in working directory differ from files in requested revision |
|
203 | 203 | [255] |
|
204 | 204 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore |
|
205 | 205 | localignored: untracked file differs |
|
206 | 206 | abort: untracked files in working directory differ from files in requested revision |
|
207 | 207 | [255] |
|
208 | 208 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort |
|
209 | 209 | b: untracked file differs |
|
210 | 210 | abort: untracked files in working directory differ from files in requested revision |
|
211 | 211 | [255] |
|
212 | 212 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn |
|
213 | 213 | b: replacing untracked file |
|
214 | 214 | localignored: replacing untracked file |
|
215 | 215 | merging .hgignore |
|
216 | 216 | merging for .hgignore |
|
217 | 217 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
218 | 218 | (branch merge, don't forget to commit) |
|
219 | 219 | $ cat localignored |
|
220 | 220 | This is file localignored3 |
|
221 | 221 | $ cat localignored.orig |
|
222 | 222 | This is file localignored4 |
|
223 | 223 | $ rm localignored.orig |
|
224 | 224 | |
|
225 | 225 | $ cat b.orig |
|
226 | 226 | This is file b2 |
|
227 | 227 | $ hg up --clean 2 |
|
228 | 228 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
229 | 229 | $ mv b.orig b |
|
230 | 230 | |
|
231 | 231 | this merge of b should work |
|
232 | 232 | $ cat b |
|
233 | 233 | This is file b2 |
|
234 | 234 | $ hg merge -f 1 |
|
235 | 235 | merging b |
|
236 | 236 | merging for b |
|
237 | 237 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
238 | 238 | (branch merge, don't forget to commit) |
|
239 | 239 | $ hg diff --nodates |
|
240 | 240 | diff -r 49035e18a8e6 b |
|
241 | 241 | --- /dev/null |
|
242 | 242 | +++ b/b |
|
243 | 243 | @@ -0,0 +1,1 @@ |
|
244 | 244 | +This is file b2 |
|
245 | 245 | $ hg status |
|
246 | 246 | M b |
|
247 | 247 | $ cd ..; rm -r t |
|
248 | 248 | |
|
249 | 249 | $ hg init t |
|
250 | 250 | $ cd t |
|
251 | 251 | $ echo This is file a1 > a |
|
252 | 252 | $ hg add a |
|
253 | 253 | $ hg commit -m "commit #0" |
|
254 | 254 | $ echo This is file b1 > b |
|
255 | 255 | $ hg add b |
|
256 | 256 | $ hg commit -m "commit #1" |
|
257 | 257 | $ echo This is file b22 > b |
|
258 | 258 | $ hg commit -m "commit #2" |
|
259 | 259 | $ hg update 1 |
|
260 | 260 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
261 | 261 | $ echo This is file c1 > c |
|
262 | 262 | $ hg add c |
|
263 | 263 | $ hg commit -m "commit #3" |
|
264 | 264 | created new head |
|
265 | 265 | |
|
266 | 266 | Contents of b should be "this is file b1" |
|
267 | 267 | $ cat b |
|
268 | 268 | This is file b1 |
|
269 | 269 | |
|
270 | 270 | $ echo This is file b22 > b |
|
271 | 271 | merge fails |
|
272 | 272 | $ hg merge 2 |
|
273 | 273 | abort: uncommitted changes |
|
274 | 274 | (use 'hg status' to list changes) |
|
275 | 275 | [255] |
|
276 | 276 | merge expected! |
|
277 | 277 | $ hg merge -f 2 |
|
278 | 278 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
279 | 279 | (branch merge, don't forget to commit) |
|
280 | 280 | $ hg diff --nodates |
|
281 | 281 | diff -r 85de557015a8 b |
|
282 | 282 | --- a/b |
|
283 | 283 | +++ b/b |
|
284 | 284 | @@ -1,1 +1,1 @@ |
|
285 | 285 | -This is file b1 |
|
286 | 286 | +This is file b22 |
|
287 | 287 | $ hg status |
|
288 | 288 | M b |
|
289 | 289 | $ cd ..; rm -r t |
|
290 | 290 | |
|
291 | 291 | $ hg init t |
|
292 | 292 | $ cd t |
|
293 | 293 | $ echo This is file a1 > a |
|
294 | 294 | $ hg add a |
|
295 | 295 | $ hg commit -m "commit #0" |
|
296 | 296 | $ echo This is file b1 > b |
|
297 | 297 | $ hg add b |
|
298 | 298 | $ hg commit -m "commit #1" |
|
299 | 299 | $ echo This is file b22 > b |
|
300 | 300 | $ hg commit -m "commit #2" |
|
301 | 301 | $ hg update 1 |
|
302 | 302 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
303 | 303 | $ echo This is file c1 > c |
|
304 | 304 | $ hg add c |
|
305 | 305 | $ hg commit -m "commit #3" |
|
306 | 306 | created new head |
|
307 | 307 | $ echo This is file b33 > b |
|
308 | 308 | merge of b should fail |
|
309 | 309 | $ hg merge 2 |
|
310 | 310 | abort: uncommitted changes |
|
311 | 311 | (use 'hg status' to list changes) |
|
312 | 312 | [255] |
|
313 | 313 | merge of b expected |
|
314 | 314 | $ hg merge -f 2 |
|
315 | 315 | merging b |
|
316 | 316 | merging for b |
|
317 | 317 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
318 | 318 | (branch merge, don't forget to commit) |
|
319 | 319 | $ hg diff --nodates |
|
320 | 320 | diff -r 85de557015a8 b |
|
321 | 321 | --- a/b |
|
322 | 322 | +++ b/b |
|
323 | 323 | @@ -1,1 +1,1 @@ |
|
324 | 324 | -This is file b1 |
|
325 | 325 | +This is file b33 |
|
326 | 326 | $ hg status |
|
327 | 327 | M b |
|
328 | 328 | |
|
329 | 329 | Test for issue2364 |
|
330 | 330 | |
|
331 | 331 | $ hg up -qC . |
|
332 | 332 | $ hg rm b |
|
333 | 333 | $ hg ci -md |
|
334 | 334 | $ hg revert -r -2 b |
|
335 | 335 | $ hg up -q -- -2 |
|
336 | 336 | |
|
337 | 337 | Test that updated files are treated as "modified", when |
|
338 | 338 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents |
|
339 | 339 | aren't changed), even if none of mode, size and timestamp of them |
|
340 | 340 | isn't changed on the filesystem (see also issue4583). |
|
341 | 341 | |
|
342 | 342 | $ cat > $TESTTMP/abort.py <<EOF |
|
343 | > from __future__ import absolute_import | |
|
343 | 344 | > # emulate aborting before "recordupdates()". in this case, files |
|
344 | 345 | > # are changed without updating dirstate |
|
345 |
> from mercurial import |
|
|
346 | > from mercurial import ( | |
|
347 | > error, | |
|
348 | > extensions, | |
|
349 | > merge, | |
|
350 | > ) | |
|
346 | 351 | > def applyupdates(orig, *args, **kwargs): |
|
347 | 352 | > orig(*args, **kwargs) |
|
348 | 353 | > raise error.Abort('intentional aborting') |
|
349 | 354 | > def extsetup(ui): |
|
350 | 355 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) |
|
351 | 356 | > EOF |
|
352 | 357 | |
|
353 | 358 | $ cat >> .hg/hgrc <<EOF |
|
354 | 359 | > [fakedirstatewritetime] |
|
355 | 360 | > # emulate invoking dirstate.write() via repo.status() |
|
356 | 361 | > # at 2000-01-01 00:00 |
|
357 | 362 | > fakenow = 200001010000 |
|
358 | 363 | > EOF |
|
359 | 364 | |
|
360 | 365 | (file gotten from other revision) |
|
361 | 366 | |
|
362 | 367 | $ hg update -q -C 2 |
|
363 | 368 | $ echo 'THIS IS FILE B5' > b |
|
364 | 369 | $ hg commit -m 'commit #5' |
|
365 | 370 | |
|
366 | 371 | $ hg update -q -C 3 |
|
367 | 372 | $ cat b |
|
368 | 373 | This is file b1 |
|
369 | 374 | $ touch -t 200001010000 b |
|
370 | 375 | $ hg debugrebuildstate |
|
371 | 376 | |
|
372 | 377 | $ cat >> .hg/hgrc <<EOF |
|
373 | 378 | > [extensions] |
|
374 | 379 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
375 | 380 | > abort = $TESTTMP/abort.py |
|
376 | 381 | > EOF |
|
377 | 382 | $ hg merge 5 |
|
378 | 383 | abort: intentional aborting |
|
379 | 384 | [255] |
|
380 | 385 | $ cat >> .hg/hgrc <<EOF |
|
381 | 386 | > [extensions] |
|
382 | 387 | > fakedirstatewritetime = ! |
|
383 | 388 | > abort = ! |
|
384 | 389 | > EOF |
|
385 | 390 | |
|
386 | 391 | $ cat b |
|
387 | 392 | THIS IS FILE B5 |
|
388 | 393 | $ touch -t 200001010000 b |
|
389 | 394 | $ hg status -A b |
|
390 | 395 | M b |
|
391 | 396 | |
|
392 | 397 | (file merged from other revision) |
|
393 | 398 | |
|
394 | 399 | $ hg update -q -C 3 |
|
395 | 400 | $ echo 'this is file b6' > b |
|
396 | 401 | $ hg commit -m 'commit #6' |
|
397 | 402 | created new head |
|
398 | 403 | |
|
399 | 404 | $ cat b |
|
400 | 405 | this is file b6 |
|
401 | 406 | $ touch -t 200001010000 b |
|
402 | 407 | $ hg debugrebuildstate |
|
403 | 408 | |
|
404 | 409 | $ cat >> .hg/hgrc <<EOF |
|
405 | 410 | > [extensions] |
|
406 | 411 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
407 | 412 | > abort = $TESTTMP/abort.py |
|
408 | 413 | > EOF |
|
409 | 414 | $ hg merge --tool internal:other 5 |
|
410 | 415 | abort: intentional aborting |
|
411 | 416 | [255] |
|
412 | 417 | $ cat >> .hg/hgrc <<EOF |
|
413 | 418 | > [extensions] |
|
414 | 419 | > fakedirstatewritetime = ! |
|
415 | 420 | > abort = ! |
|
416 | 421 | > EOF |
|
417 | 422 | |
|
418 | 423 | $ cat b |
|
419 | 424 | THIS IS FILE B5 |
|
420 | 425 | $ touch -t 200001010000 b |
|
421 | 426 | $ hg status -A b |
|
422 | 427 | M b |
|
423 | 428 | |
|
424 | 429 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now