2490 # XXX should we check for rename down to target node? |
2490 # XXX should we check for rename down to target node? |
2491 if src and src not in names and repo.dirstate[src] == 'r': |
2491 if src and src not in names and repo.dirstate[src] == 'r': |
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): |
2498 if repo.dirstate[abs] == 'a': |
2516 if repo.dirstate[abs] == 'a': |
2499 return _('forgetting %s\n') |
2517 return _('forgetting %s\n') |
2526 # Modified compared to target, local change |
2544 # Modified compared to target, local change |
2527 (dsmodified, actions['revert'], backup), |
2545 (dsmodified, actions['revert'], backup), |
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), |
2537 # Existing file, not tracked anywhere |
2559 # Existing file, not tracked anywhere |
2538 (unknown, actions['unknown'], discard), |
2560 (unknown, actions['unknown'], discard), |