comparison hgext/shelve.py @ 42825:e08559769bc6

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 29 Mar 2019 11:32:02 -0700
parents 4606585549b1
children 03f6480bfdda
comparison
equal deleted inserted replaced
42824:4606585549b1 42825:e08559769bc6
672 def mergefiles(ui, repo, wctx, shelvectx): 672 def mergefiles(ui, repo, wctx, shelvectx):
673 """updates to wctx and merges the changes from shelvectx into the 673 """updates to wctx and merges the changes from shelvectx into the
674 dirstate.""" 674 dirstate."""
675 with ui.configoverride({('ui', 'quiet'): True}): 675 with ui.configoverride({('ui', 'quiet'): True}):
676 hg.update(repo, wctx.node()) 676 hg.update(repo, wctx.node())
677 files = []
678 files.extend(shelvectx.files())
679 files.extend(shelvectx.p1().files())
680
681 # revert will overwrite unknown files, so move them out of the way
682 for file in repo.status(unknown=True).unknown:
683 if file in files:
684 util.rename(repo.wjoin(file),
685 scmutil.backuppath(ui, repo, file))
686 ui.pushbuffer(True) 677 ui.pushbuffer(True)
687 cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), 678 cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents())
688 **{r'no_backup': True})
689 ui.popbuffer() 679 ui.popbuffer()
690 680
691 def restorebranch(ui, repo, branchtorestore): 681 def restorebranch(ui, repo, branchtorestore):
692 if branchtorestore and branchtorestore != repo.dirstate.branch(): 682 if branchtorestore and branchtorestore != repo.dirstate.branch():
693 repo.dirstate.setbranch(branchtorestore) 683 repo.dirstate.setbranch(branchtorestore)