From patchwork Thu Feb 7 02:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D5852: shelve: fix broken backup of conflicting untracked file From: phabricator X-Patchwork-Id: 38505 Message-Id: <58e2c17378abd0805d1a4c053a85c57a@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Thu, 7 Feb 2019 02:03:27 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG630af04d4ae4: shelve: fix broken backup of conflicting untracked file (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5852?vs=13857&id=13874 REVISION DETAIL https://phab.mercurial-scm.org/D5852 AFFECTED FILES hgext/shelve.py tests/test-shelve2.t CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t --- a/tests/test-shelve2.t +++ b/tests/test-shelve2.t @@ -139,21 +139,13 @@ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved $ echo z > e $ mkdir dir -BROKEN: should work the same as when not using --cwd $ hg unshelve --cwd dir unshelving change 'default' - abort: $ENOENT$ - [255] $ rmdir dir $ cat e + e + $ cat e.orig z - $ test -f e.orig && cat e.orig - [1] -restore broken state - $ touch d - $ echo e > e - $ hg add d e - $ hg shelve --delete default unshelve and conflicts with tracked and untracked files diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -679,7 +679,8 @@ # 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(file, scmutil.origpath(ui, repo, file)) + util.rename(repo.wjoin(file), + scmutil.backuppath(ui, repo, file)) ui.pushbuffer(True) cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), *pathtofiles(repo, files),