[PATCH STABLE] shelve: make unshelve work even if it don't run in repository root
Takumi IINO
trot.thunder at gmail.com
Tue Oct 22 08:22:59 CDT 2013
# HG changeset patch
# User Takumi IINO <trot.thunder at gmail.com>
# Date 1382413265 -32400
# Tue Oct 22 12:41:05 2013 +0900
# Branch stable
# Node ID 5023e19c1bbde7afdc977deebdd830604cc72588
# Parent 2c886dedd9021598b6290d95ea0f068731ea4e2b
shelve: make unshelve work even if it don't run in repository root
revertfiles are relative to the repository root. not paths relative to the cwd.
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -358,6 +358,10 @@
raise util.Abort(_('working directory parents do not match unshelve '
'state'))
+def pathtofiles(repo, files):
+ cwd = repo.getcwd()
+ return [repo.pathto(f, cwd) for f in files]
+
def unshelveabort(ui, repo, state, opts):
"""subcommand that abort an in-progress unshelve"""
wlock = repo.wlock()
@@ -372,7 +376,7 @@
revertfiles = readshelvedfiles(repo, state.name)
wctx = repo.parents()[0]
cmdutil.revert(ui, repo, wctx, [wctx.node(), nullid],
- *revertfiles, **{'no_backup': True})
+ *pathtofiles(repo, revertfiles), **{'no_backup': True})
# fix up the weird dirstate states the merge left behind
mf = wctx.manifest()
dirstate = repo.dirstate
@@ -532,7 +536,7 @@
revertfiles = set(parents[1].files()).difference(ms)
cmdutil.revert(ui, repo, parents[1],
(parents[0].node(), nullid),
- *revertfiles, **{'no_backup': True})
+ *pathtofiles(repo, revertfiles), **{'no_backup': True})
raise error.InterventionRequired(
_("unresolved conflicts (see 'hg resolve', then "
"'hg unshelve --continue')"))
@@ -540,8 +544,8 @@
else:
parent = tip.parents()[0]
hg.update(repo, parent.node())
- cmdutil.revert(ui, repo, tip, repo.dirstate.parents(), *tip.files(),
- **{'no_backup': True})
+ cmdutil.revert(ui, repo, tip, repo.dirstate.parents(),
+ *pathtofiles(repo, tip.files()), **{'no_backup': True})
prevquiet = ui.quiet
ui.quiet = True
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -165,7 +165,9 @@
and now "a/a" should reappear
+ $ cd a
$ hg unshelve -q wibble
+ $ cd ..
$ hg status -C
M a/a
A b.rename/b
More information about the Mercurial-devel
mailing list