Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 22190:55308ab8117c
revert: use modified information from both statuses
Using status information against the target ensures we are catching all
files with modifications that need reverting.
We still need to distinguish fresh modifications for backup purpose.
test-largefile is affected because it reverted a file that needs no content
change.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 24 Jun 2014 17:27:18 +0100 |
parents | cde6b489365c |
children | 9fa429723f26 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Jun 24 16:57:16 2014 +0100 +++ b/mercurial/cmdutil.py Tue Jun 24 17:27:18 2014 +0100 @@ -2408,7 +2408,6 @@ dsadded = set(changes[1]) dsremoved = set(changes[2]) dsadded |= _deletedadded - dsmodified |= _deletedmodified # only take into account for removes between wc and target clean |= dsremoved - removed @@ -2416,6 +2415,11 @@ # distinct between dirstate remove and other removed -= dsremoved + # tell newly modified apart. + dsmodified &= modified + dsmodified |= modified & dsadded # dirstate added may needs backup + modified -= dsmodified + # if f is a rename, update `names` to also revert the source cwd = repo.getcwd() for f in dsadded: @@ -2448,6 +2452,7 @@ # file state # action # make backup + (modified, (actions['revert'], False)), (dsmodified, (actions['revert'], True)), (missingmodified, (actions['remove'], True)), (dsadded, (actions['revert'], True)),