Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 22397:1db04829bdc1
revert: distinguish between deleted file and locally modified
Locally modified needs a backup while a deleted file cannot be backed
up because there is no file to backup.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 30 Aug 2014 02:09:53 +0200 |
parents | c0213f2cb942 |
children | 402e5fba6509 |
comparison
equal
deleted
inserted
replaced
22396:c0213f2cb942 | 22397:1db04829bdc1 |
---|---|
2423 # split between files known in target manifest and the others | 2423 # split between files known in target manifest and the others |
2424 smf = set(mf) | 2424 smf = set(mf) |
2425 | 2425 |
2426 # determine the exact nature of the deleted changesets | 2426 # determine the exact nature of the deleted changesets |
2427 _deletedadded = _deleted - smf | 2427 _deletedadded = _deleted - smf |
2428 _deletedmodified = _deleted - _deletedadded | 2428 deleted = _deleted - _deletedadded |
2429 added |= _deletedadded | 2429 added |= _deletedadded |
2430 modified |= _deletedmodified | |
2431 | 2430 |
2432 # We need to account for the state of file in the dirstate | 2431 # We need to account for the state of file in the dirstate |
2433 # | 2432 # |
2434 # Even, when we revert agains something else than parent. this will | 2433 # Even, when we revert agains something else than parent. this will |
2435 # slightly alter the behavior of revert (doing back up or not, delete | 2434 # slightly alter the behavior of revert (doing back up or not, delete |
2539 # make backup | 2538 # make backup |
2540 | 2539 |
2541 ## Sets that results that will change file on disk | 2540 ## Sets that results that will change file on disk |
2542 # Modified compared to target, no local change | 2541 # Modified compared to target, no local change |
2543 (modified, actions['revert'], discard), | 2542 (modified, actions['revert'], discard), |
2543 # Modified compared to target, but local file is deleted | |
2544 (deleted, actions['revert'], discard), | |
2544 # Modified compared to target, local change | 2545 # Modified compared to target, local change |
2545 (dsmodified, actions['revert'], backup), | 2546 (dsmodified, actions['revert'], backup), |
2546 # Added since target | 2547 # Added since target |
2547 (dsadded, actions['remove'], discard), | 2548 (dsadded, actions['remove'], discard), |
2548 # Removed since target, before working copy parent | 2549 # Removed since target, before working copy parent |