Patchwork [4,of,5,V2] revert: no backup for `dsadded` set

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 8, 2014, 2:58 p.m.
Message ID <f2199b928fd12e6b8238.1410188301@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5717/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 8, 2014, 2:58 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1409356168 -7200
#      Sat Aug 30 01:49:28 2014 +0200
# Node ID f2199b928fd12e6b82387e7563e683e935df455c
# Parent  88e9546f2f323f2bb63acc37cb2fcb6fba4d1d0b
revert: no backup for `dsadded` set

There are only one case where backup is required in the `dsadded` set. And the
current backup mechanism fails to backup it. So we stop trying to do backup at
all for now. This will helps us to simplifies the backup code and finally fix
this backup issue.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2523,11 +2523,11 @@  def revert(ui, repo, ctx, parents, *pats
             # Modified compared to target, no local change
             (modified,      actions['revert'],   discard),
             # Modified compared to target, local change
             (dsmodified,    actions['revert'],   backup),
             # Added since target
-            (dsadded,       actions['remove'],   backup),
+            (dsadded,       actions['remove'],   discard),
             # Removed since  target, before working copy parent
             (removed,       actions['add'],      backup),
             # Removed since targe, marked as such in working copy parent
             (dsremoved,     actions['undelete'], backup),
             ## the following sets does not result in any file changes
@@ -2535,11 +2535,11 @@  def revert(ui, repo, ctx, parents, *pats
             (clean,         actions['noop'],     discard),
             # Existing file, not tracked anywhere
             (unknown,       actions['unknown'],  discard),
             )
 
-        needdata = ('revert', 'add', 'remove', 'undelete')
+        needdata = ('revert', 'add', 'undelete')
         _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
 
         for abs, (rel, exact) in sorted(names.items()):
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)