##// END OF EJS Templates
shelve: make unshelve work even if it don't run in repository root...
Takumi IINO -
r19943:4de11687 stable
parent child Browse files
Show More
@@ -358,6 +358,10 b' def checkparents(repo, state):'
358 raise util.Abort(_('working directory parents do not match unshelve '
358 raise util.Abort(_('working directory parents do not match unshelve '
359 'state'))
359 'state'))
360
360
361 def pathtofiles(repo, files):
362 cwd = repo.getcwd()
363 return [repo.pathto(f, cwd) for f in files]
364
361 def unshelveabort(ui, repo, state, opts):
365 def unshelveabort(ui, repo, state, opts):
362 """subcommand that abort an in-progress unshelve"""
366 """subcommand that abort an in-progress unshelve"""
363 wlock = repo.wlock()
367 wlock = repo.wlock()
@@ -372,7 +376,8 b' def unshelveabort(ui, repo, state, opts)'
372 revertfiles = readshelvedfiles(repo, state.name)
376 revertfiles = readshelvedfiles(repo, state.name)
373 wctx = repo.parents()[0]
377 wctx = repo.parents()[0]
374 cmdutil.revert(ui, repo, wctx, [wctx.node(), nullid],
378 cmdutil.revert(ui, repo, wctx, [wctx.node(), nullid],
375 *revertfiles, **{'no_backup': True})
379 *pathtofiles(repo, revertfiles),
380 **{'no_backup': True})
376 # fix up the weird dirstate states the merge left behind
381 # fix up the weird dirstate states the merge left behind
377 mf = wctx.manifest()
382 mf = wctx.manifest()
378 dirstate = repo.dirstate
383 dirstate = repo.dirstate
@@ -532,7 +537,8 b' def unshelve(ui, repo, *shelved, **opts)'
532 revertfiles = set(parents[1].files()).difference(ms)
537 revertfiles = set(parents[1].files()).difference(ms)
533 cmdutil.revert(ui, repo, parents[1],
538 cmdutil.revert(ui, repo, parents[1],
534 (parents[0].node(), nullid),
539 (parents[0].node(), nullid),
535 *revertfiles, **{'no_backup': True})
540 *pathtofiles(repo, revertfiles),
541 **{'no_backup': True})
536 raise error.InterventionRequired(
542 raise error.InterventionRequired(
537 _("unresolved conflicts (see 'hg resolve', then "
543 _("unresolved conflicts (see 'hg resolve', then "
538 "'hg unshelve --continue')"))
544 "'hg unshelve --continue')"))
@@ -540,7 +546,8 b' def unshelve(ui, repo, *shelved, **opts)'
540 else:
546 else:
541 parent = tip.parents()[0]
547 parent = tip.parents()[0]
542 hg.update(repo, parent.node())
548 hg.update(repo, parent.node())
543 cmdutil.revert(ui, repo, tip, repo.dirstate.parents(), *tip.files(),
549 cmdutil.revert(ui, repo, tip, repo.dirstate.parents(),
550 *pathtofiles(repo, tip.files()),
544 **{'no_backup': True})
551 **{'no_backup': True})
545
552
546 prevquiet = ui.quiet
553 prevquiet = ui.quiet
@@ -165,7 +165,9 b' expect "a" to no longer be present, but '
165
165
166 and now "a/a" should reappear
166 and now "a/a" should reappear
167
167
168 $ cd a
168 $ hg unshelve -q wibble
169 $ hg unshelve -q wibble
170 $ cd ..
169 $ hg status -C
171 $ hg status -C
170 M a/a
172 M a/a
171 A b.rename/b
173 A b.rename/b
General Comments 0
You need to be logged in to leave comments. Login now