[PATCH 4 of 5] revert: remove code killed by the double status

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 15 11:48:46 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1403627844 -3600
#      Tue Jun 24 17:37:24 2014 +0100
# Node ID 3c4496ffc5eb12218c8d07efb833ac99aff63ed5
# Parent  5548613bc2904a03757dce37cc9613f1a3c74f73
revert: remove code killed by the double status

All those checks were here to catch cases where files were not modified in
dirstate but wer different in the target revision. This is now properly handled
by calling status on the target node too.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2474,12 +2474,10 @@ def revert(ui, repo, ctx, parents, *pats
             (dsremoved,        (actions['undelete'], True)),
             (clean,            (None,                False)),
             )
 
         for abs, (rel, exact) in sorted(names.items()):
-            # hash on file in target manifest (or None if missing from target)
-            mfentry = mf.get(abs)
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)
             def handle(xlist, dobackup):
                 xlist[0].append(abs)
                 if (dobackup and not opts.get('no_backup') and
@@ -2520,23 +2518,10 @@ def revert(ui, repo, ctx, parents, *pats
                 # parent is target, no changes mean no changes
                 if node == parent:
                     if exact:
                         ui.warn(_('no changes needed to %s\n') % rel)
                     continue
-                # no change in dirstate but parent and target may differ
-                if pmf is None:
-                    # only need parent manifest in this unlikely case,
-                    # so do not read by default
-                    pmf = repo[parent].manifest()
-                if abs in pmf and mfentry:
-                    # if version of file is same in parent and target
-                    # manifests, do nothing
-                    if (pmf[abs] != mfentry or
-                        pmf.flags(abs) != mf.flags(abs)):
-                        handle(actions['revert'], False)
-                else:
-                    handle(actions['remove'], False)
 
         if not opts.get('dry_run'):
             _performrevert(repo, parents, ctx, actions)
 
             if targetsubs:


More information about the Mercurial-devel mailing list