##// END OF EJS Templates
shelve: move temporary commit creation to a separate function...
Kostia Balytskyi -
r30453:2e736f01 default
parent child Browse files
Show More
@@ -630,6 +630,26 b' def unshelvecontinue(ui, repo, state, op'
630 unshelvecleanup(ui, repo, state.name, opts)
630 unshelvecleanup(ui, repo, state.name, opts)
631 ui.status(_("unshelve of '%s' complete\n") % state.name)
631 ui.status(_("unshelve of '%s' complete\n") % state.name)
632
632
633 def _commitworkingcopychanges(ui, repo, opts, tmpwctx):
634 """Temporarily commit working copy changes before moving unshelve commit"""
635 # Store pending changes in a commit and remember added in case a shelve
636 # contains unknown files that are part of the pending change
637 s = repo.status()
638 addedbefore = frozenset(s.added)
639 if not (s.modified or s.added or s.removed or s.deleted):
640 return tmpwctx, addedbefore
641 ui.status(_("temporarily committing pending changes "
642 "(restore with 'hg unshelve --abort')\n"))
643 commitfunc = getcommitfunc(extra=None, interactive=False,
644 editor=False)
645 tempopts = {}
646 tempopts['message'] = "pending changes temporary commit"
647 tempopts['date'] = opts.get('date')
648 ui.quiet = True
649 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
650 tmpwctx = repo[node]
651 return tmpwctx, addedbefore
652
633 @command('unshelve',
653 @command('unshelve',
634 [('a', 'abort', None,
654 [('a', 'abort', None,
635 _('abort an incomplete unshelve operation')),
655 _('abort an incomplete unshelve operation')),
@@ -752,21 +772,8 b' def _dounshelve(ui, repo, *shelved, **op'
752 # and shelvectx is the unshelved changes. Then we merge it all down
772 # and shelvectx is the unshelved changes. Then we merge it all down
753 # to the original pctx.
773 # to the original pctx.
754
774
755 # Store pending changes in a commit and remember added in case a shelve
775 tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts,
756 # contains unknown files that are part of the pending change
776 tmpwctx)
757 s = repo.status()
758 addedbefore = frozenset(s.added)
759 if s.modified or s.added or s.removed or s.deleted:
760 ui.status(_("temporarily committing pending changes "
761 "(restore with 'hg unshelve --abort')\n"))
762 commitfunc = getcommitfunc(extra=None, interactive=False,
763 editor=False)
764 tempopts = {}
765 tempopts['message'] = "pending changes temporary commit"
766 tempopts['date'] = opts.get('date')
767 ui.quiet = True
768 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
769 tmpwctx = repo[node]
770
777
771 ui.quiet = True
778 ui.quiet = True
772 shelvedfile(repo, basename, 'hg').applybundle()
779 shelvedfile(repo, basename, 'hg').applybundle()
General Comments 0
You need to be logged in to leave comments. Login now