# HG changeset patch # User Martin von Zweigbergk # Date 2019-03-29 18:32:02 # Node ID e08559769bc69a76c79c41728dd6790aeb85c18b # Parent 4606585549b1bf8c036ed40e7dc54199b1a3a703 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 diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -674,18 +674,8 @@ def mergefiles(ui, repo, wctx, shelvectx 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):