##// END OF EJS Templates
revert: split between newly added file and file added in other changeset...
Pierre-Yves David -
r22488:6c52ed3f default
parent child Browse files
Show More
@@ -2554,20 +2554,9 b' def revert(ui, repo, ctx, parents, *pats'
2554 dsmodified |= modified & dsadded # dirstate added may needs backup
2554 dsmodified |= modified & dsadded # dirstate added may needs backup
2555 modified -= dsmodified
2555 modified -= dsmodified
2556
2556
2557 # There are three categories of added files
2557 # We need to wait for some post-processing to update this set
2558 #
2558 # before making the distinction. The dirstate will be used for
2559 # 1. addition that just happened in the dirstate
2559 # that purpose.
2560 # (should be forgotten)
2561 # 2. file is added since target revision and has local changes
2562 # (should be backed up and removed)
2563 # 3. file is added since target revision and is clean
2564 # (should be removed)
2565 #
2566 # However we do not need to split them yet. The current revert code
2567 # will automatically recognize (1) when performing operation. And
2568 # the backup system is currently unabled to handle (2).
2569 #
2570 # So we just put them all in the same group.
2571 dsadded = added
2560 dsadded = added
2572
2561
2573 # in case of merge, files that are actually added can be reported as
2562 # in case of merge, files that are actually added can be reported as
@@ -2590,6 +2579,13 b' def revert(ui, repo, ctx, parents, *pats'
2590 dsremoved.add(src)
2579 dsremoved.add(src)
2591 names[src] = (repo.pathto(src, cwd), True)
2580 names[src] = (repo.pathto(src, cwd), True)
2592
2581
2582 # distinguish between file to forget and the other
2583 added = set()
2584 for abs in dsadded:
2585 if repo.dirstate[abs] != 'a':
2586 added.add(abs)
2587 dsadded -= added
2588
2593 # For files marked as removed, we check if an unknown file is present at
2589 # For files marked as removed, we check if an unknown file is present at
2594 # the same path. If a such file exists it may need to be backed up.
2590 # the same path. If a such file exists it may need to be backed up.
2595 # Making the distinction at this stage helps have simpler backup
2591 # Making the distinction at this stage helps have simpler backup
@@ -2644,6 +2640,8 b' def revert(ui, repo, ctx, parents, *pats'
2644 # Modified compared to target, local change
2640 # Modified compared to target, local change
2645 (dsmodified, actions['revert'], backup),
2641 (dsmodified, actions['revert'], backup),
2646 # Added since target
2642 # Added since target
2643 (added, actions['remove'], discard),
2644 # Added in working directory
2647 (dsadded, actions['remove'], discard),
2645 (dsadded, actions['remove'], discard),
2648 # Removed since target, before working copy parent
2646 # Removed since target, before working copy parent
2649 (removed, actions['add'], discard),
2647 (removed, actions['add'], discard),
General Comments 0
You need to be logged in to leave comments. Login now