##// END OF EJS Templates
revert: detect unknown files in the same path as files marked as removed...
Pierre-Yves David -
r22396:c0213f2c default
parent child Browse files
Show More
@@ -2492,6 +2492,24 b' def revert(ui, repo, ctx, parents, *pats'
2492 dsremoved.add(src)
2492 dsremoved.add(src)
2493 names[src] = (repo.pathto(src, cwd), True)
2493 names[src] = (repo.pathto(src, cwd), True)
2494
2494
2495 # For files marked as removed, we check if an unknown file is present at
2496 # the same path. If a such file exists it may need to be backed up.
2497 # Making the distinction at this stage helps have simpler backup
2498 # logic.
2499 removunk = set()
2500 for abs in removed:
2501 target = repo.wjoin(abs)
2502 if os.path.lexists(target):
2503 removunk.add(abs)
2504 removed -= removunk
2505
2506 dsremovunk = set()
2507 for abs in dsremoved:
2508 target = repo.wjoin(abs)
2509 if os.path.lexists(target):
2510 dsremovunk.add(abs)
2511 dsremoved -= dsremovunk
2512
2495 ## computation of the action to performs on `names` content.
2513 ## computation of the action to performs on `names` content.
2496
2514
2497 def removeforget(abs):
2515 def removeforget(abs):
@@ -2528,9 +2546,13 b' def revert(ui, repo, ctx, parents, *pats'
2528 # Added since target
2546 # Added since target
2529 (dsadded, actions['remove'], discard),
2547 (dsadded, actions['remove'], discard),
2530 # Removed since target, before working copy parent
2548 # Removed since target, before working copy parent
2531 (removed, actions['add'], backup),
2549 (removed, actions['add'], discard),
2550 # Same as `removed` but an unknown file exists at the same path
2551 (removunk, actions['add'], backup),
2532 # Removed since targe, marked as such in working copy parent
2552 # Removed since targe, marked as such in working copy parent
2533 (dsremoved, actions['undelete'], backup),
2553 (dsremoved, actions['undelete'], discard),
2554 # Same as `dsremoved` but an unknown file exists at the same path
2555 (dsremovunk, actions['undelete'], backup),
2534 ## the following sets does not result in any file changes
2556 ## the following sets does not result in any file changes
2535 # File with no modification
2557 # File with no modification
2536 (clean, actions['noop'], discard),
2558 (clean, actions['noop'], discard),
General Comments 0
You need to be logged in to leave comments. Login now