# HG changeset patch # User Pierre-Yves David # Date 2014-08-30 00:39:08 # Node ID 0f323ed8effd86aabcc28faf9e453a94d500c8fe # Parent 3760ebf786b84ab2d9fc4108d14333c3ec3fedfc revert: track added files with local modifications Those files need to be backed up but are currently not. We compute the set of them to be able to use a different backup strategy in the next changeset. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2524,6 +2524,7 @@ def revert(ui, repo, ctx, parents, *pats unknown = set(changes[4]) unknown.update(changes[5]) clean = set(changes[6]) + modadded = set() # split between files known in target manifest and the others smf = set(mf) @@ -2554,6 +2555,9 @@ def revert(ui, repo, ctx, parents, *pats # distinct between dirstate remove and other removed -= dsremoved + modadded = added & dsmodified + added -= modadded + # tell newly modified apart. dsmodified &= modified dsmodified |= modified & dsadded # dirstate added may needs backup @@ -2653,6 +2657,8 @@ def revert(ui, repo, ctx, parents, *pats (added, actions['remove'], discard), # Added in working directory (dsadded, actions['forget'], discard), + # Added since target, have local modification + (modadded, actions['remove'], discard), # Added since target but file is missing in working directory (deladded, actions['drop'], discard), # Removed since target, before working copy parent