comparison tests/test-rename.t @ 39350:5b92a717bfc1

rename: return error status if any rename/copy failed Ever since 447ea621e50e (copy: propagate errors properly, 2007-12-06), we have returned an error status if the source file did not exist. That commit did not return error status for any other errors, and it's unclear if that was on purpose or not. It seems to me like we should return an error in the other cases to, so that's what this patch does. Differential Revision: https://phab.mercurial-scm.org/D4419
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 29 Aug 2018 09:59:08 -0700
parents cde75233c415
children 8d72e29ad1e0
comparison
equal deleted inserted replaced
39349:534e451b6dda 39350:5b92a717bfc1
69 69
70 rename --after a single file to a nonexistent target filename 70 rename --after a single file to a nonexistent target filename
71 71
72 $ hg rename --after d1/a dummy 72 $ hg rename --after d1/a dummy
73 d1/a: not recording move - dummy does not exist 73 d1/a: not recording move - dummy does not exist
74 [1]
74 75
75 move a single file to an existing directory 76 move a single file to an existing directory
76 77
77 $ hg rename d1/d11/a1 d2 78 $ hg rename d1/d11/a1 d2
78 $ hg status -C 79 $ hg status -C
266 267
267 $ hg rename d1/* d2 268 $ hg rename d1/* d2
268 d2/b: not overwriting - file already committed 269 d2/b: not overwriting - file already committed
269 ('hg rename --force' to replace the file by recording a rename) 270 ('hg rename --force' to replace the file by recording a rename)
270 moving d1/d11/a1 to d2/d11/a1 271 moving d1/d11/a1 to d2/d11/a1
272 [1]
271 $ hg status -C 273 $ hg status -C
272 A d2/a 274 A d2/a
273 d1/a 275 d1/a
274 A d2/ba 276 A d2/ba
275 d1/ba 277 d1/ba
336 $ hg rename --after 'glob:d1/**' d2/d21 338 $ hg rename --after 'glob:d1/**' d2/d21
337 moving d1/a to d2/d21/a 339 moving d1/a to d2/d21/a
338 d1/b: not recording move - d2/d21/b does not exist 340 d1/b: not recording move - d2/d21/b does not exist
339 d1/ba: not recording move - d2/d21/ba does not exist 341 d1/ba: not recording move - d2/d21/ba does not exist
340 moving d1/d11/a1 to d2/d21/a1 342 moving d1/d11/a1 to d2/d21/a1
343 [1]
341 $ hg status -C 344 $ hg status -C
342 A d2/d21/a 345 A d2/d21/a
343 d1/a 346 d1/a
344 A d2/d21/a1 347 A d2/d21/a1
345 d1/d11/a1 348 d1/d11/a1
370 373
371 $ echo "ca" > d1/ca 374 $ echo "ca" > d1/ca
372 $ hg rename d1/ba d1/ca 375 $ hg rename d1/ba d1/ca
373 d1/ca: not overwriting - file exists 376 d1/ca: not overwriting - file exists
374 ('hg rename --after' to record the rename) 377 ('hg rename --after' to record the rename)
378 [1]
375 $ hg status -C 379 $ hg status -C
376 ? d1/ca 380 ? d1/ca
377 $ hg update -C 381 $ hg update -C
378 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 382 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
379 383
394 #if symlink 398 #if symlink
395 $ ln -s ba d1/ca 399 $ ln -s ba d1/ca
396 $ hg rename --traceback d1/ba d1/ca 400 $ hg rename --traceback d1/ba d1/ca
397 d1/ca: not overwriting - file exists 401 d1/ca: not overwriting - file exists
398 ('hg rename --after' to record the rename) 402 ('hg rename --after' to record the rename)
403 [1]
399 $ hg status -C 404 $ hg status -C
400 ? d1/ca 405 ? d1/ca
401 $ hg update -C 406 $ hg update -C
402 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 407 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 $ rm d1/ca 408 $ rm d1/ca
419 424
420 $ mkdir d3 425 $ mkdir d3
421 $ hg rename d1/* d2/* d3 426 $ hg rename d1/* d2/* d3
422 moving d1/d11/a1 to d3/d11/a1 427 moving d1/d11/a1 to d3/d11/a1
423 d3/b: not overwriting - d2/b collides with d1/b 428 d3/b: not overwriting - d2/b collides with d1/b
429 [1]
424 $ hg status -C 430 $ hg status -C
425 A d3/a 431 A d3/a
426 d1/a 432 d1/a
427 A d3/b 433 A d3/b
428 d1/b 434 d1/b