D5852: shelve: fix broken backup of conflicting untracked file
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Feb 5 17:53:15 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5852
AFFECTED FILES
hgext/shelve.py
tests/test-shelve2.t
CHANGE DETAILS
diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -139,22 +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
- z
+ e
$ cat e.orig
- cat: e.orig: $ENOENT$
- [1]
-restore broken state
- $ touch d
- $ echo e > e
- $ hg add d e
- $ hg shelve --delete default
+ z
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),
+ repo.wjoin(scmutil.backuppath(ui, repo, file)))
ui.pushbuffer(True)
cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(),
*pathtofiles(repo, files),
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list