Comments
Patch
@@ -2628,10 +2628,15 @@ def revert(ui, repo, ctx, parents, *pats
check = 1 # check if existing file differ from target
discard = 0 # never do backup
if opts.get('no_backup'):
backup = check = discard
+
+ backupanddel = actions['remove']
+ if not opts.get('no_backup'):
+ backupanddel = actions['drop']
+
disptable = (
# dispatch table:
# file state
# action
# make backup
@@ -2646,11 +2651,11 @@ def revert(ui, repo, ctx, parents, *pats
# Added since target
(added, actions['remove'], discard),
# Added in working directory
(dsadded, actions['forget'], discard),
# Added since target, have local modification
- (modadded, actions['remove'], discard),
+ (modadded, backupanddel, backup),
# Added since target but file is missing in working directory
(deladded, actions['drop'], discard),
# Removed since target, before working copy parent
(removed, actions['add'], discard),
# Same as `removed` but an unknown file exists at the same path
@@ -948,10 +948,11 @@ Misbehavior:
$ python ../dircontent.py > ../content-base-all.txt
$ cd ..
$ diff -U 0 -- content-base.txt content-base-all.txt | grep _
+parent added_untracked-clean
+wc added_untracked-wc
+ +wc added_wc.orig
+wc clean_untracked-wc.orig
+wc clean_wc.orig
+wc missing_untracked-wc
+wc missing_wc
+parent modified_untracked-clean.orig