Submitter | Takumi IINO |
---|---|
Date | Oct. 22, 2013, 1:22 p.m. |
Message ID | <5023e19c1bbde7afdc97.1382448179@iino-no-MacBook-Air.local> |
Download | mbox | patch |
Permalink | /patch/2802/ |
State | Superseded |
Commit | 4de11687104461f816dab51958a406823242b85b |
Headers | show |
Comments
This patch didn't pass some tests. Please ignore. 2013/10/22 Takumi IINO <trot.thunder@gmail.com> > # HG changeset patch > # User Takumi IINO <trot.thunder@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 >
Patch
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