[PATCH 3 of 4] revert: distinct between deleted file and locally modified
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Sep 9 20:05:40 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1409357393 -7200
# Sat Aug 30 02:09:53 2014 +0200
# Node ID 10052be213bf4471ce3df9fc87e2382c7c472209
# Parent 74eae0c1c351030c701243a3cf0fdee4003130e4
revert: distinct between deleted file and locally modified
Locally modified needs backup while deleted file cannot backed up because there
is not file to backup.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2423,13 +2423,12 @@ def revert(ui, repo, ctx, parents, *pats
# split between files known in target manifest and the others
smf = set(mf)
# determine the exact nature of the deleted changesets
_deletedadded = _deleted - smf
- _deletedmodified = _deleted - _deletedadded
+ deleted = _deleted - _deletedadded
added |= _deletedadded
- modified |= _deletedmodified
# We need to account for the state of file in the dirstate
#
# Even, when we revert agains something else than parent. this will
# slightly alter the behavior of revert (doing back up or not, delete
@@ -2539,10 +2538,12 @@ def revert(ui, repo, ctx, parents, *pats
# make backup
## Sets that results that will change file on disk
# Modified compared to target, no local change
(modified, actions['revert'], discard),
+ # Modified compared to target, but local file is deleted
+ (deleted, actions['revert'], discard),
# Modified compared to target, local change
(dsmodified, actions['revert'], backup),
# Added since target
(dsadded, actions['remove'], discard),
# Removed since target, before working copy parent
More information about the Mercurial-devel
mailing list