Patchwork D6174: shelve: let cmdutil.revert() take care of backing up untracked files

login
register
mail settings
Submitter phabricator
Date March 29, 2019, 6:39 p.m.
Message ID <differential-rev-PHID-DREV-d5n3pppxjmeh6w6ib3vb-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39413/
State Superseded
Headers show

Comments

phabricator - March 29, 2019, 6:39 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6174

AFFECTED FILES
  hgext/shelve.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -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):