shelve: let cmdutil.revert() take care of backing up untracked files
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 29 Mar 2019 11:32:02 -0700
changeset 42038 e08559769bc6
parent 42037 4606585549b1
child 42039 cab19d49f8bd
shelve: let cmdutil.revert() take care of backing up untracked files cmdutil.revert() backs up untracked files, so I don't see a reason to do it shelve.mergefiles(). We have tests for this and they still pass. Differential Revision: https://phab.mercurial-scm.org/D6174
hgext/shelve.py
--- a/hgext/shelve.py	Fri Mar 29 11:31:42 2019 -0700
+++ b/hgext/shelve.py	Fri Mar 29 11:32:02 2019 -0700
@@ -674,18 +674,8 @@
     dirstate."""
     with ui.configoverride({('ui', 'quiet'): True}):
         hg.update(repo, wctx.node())
-        files = []
-        files.extend(shelvectx.files())
-        files.extend(shelvectx.p1().files())
-
-        # revert will overwrite unknown files, so move them out of the way
-        for file in repo.status(unknown=True).unknown:
-            if file in files:
-                util.rename(repo.wjoin(file),
-                            scmutil.backuppath(ui, repo, file))
         ui.pushbuffer(True)
-        cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(),
-                       **{r'no_backup': True})
+        cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents())
         ui.popbuffer()
 
 def restorebranch(ui, repo, branchtorestore):