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

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 15, 2014, 4:48 p.m.
Message ID <3c4496ffc5eb12218c8d.1408121326@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5433/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 15, 2014, 4:48 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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: