##// END OF EJS Templates
unshelve: unify logic around creating an unshelve changeset...
Navaneeth Suresh -
r42886:c9114885 default
parent child Browse files
Show More
@@ -721,15 +721,8 b' def unshelvecontinue(ui, repo, state, op'
721 721 with repo.ui.configoverride(overrides, 'unshelve'):
722 722 with repo.dirstate.parentchange():
723 723 repo.setparents(state.parents[0], nodemod.nullid)
724 if not interactive:
725 ispartialunshelve = False
726 newnode = repo.commit(text=shelvectx.description(),
727 extra=shelvectx.extra(),
728 user=shelvectx.user(),
729 date=shelvectx.date())
730 else:
731 newnode, ispartialunshelve = _dounshelveinteractive(ui,
732 repo, shelvectx, basename, opts)
724 newnode, ispartialunshelve = _createunshelvectx(ui,
725 repo, shelvectx, basename, interactive, opts)
733 726
734 727 if newnode is None:
735 728 # If it ended up being a no-op commit, then the normal
@@ -804,14 +797,37 b' def _unshelverestorecommit(ui, repo, tr,'
804 797
805 798 return repo, shelvectx
806 799
807 def _dounshelveinteractive(ui, repo, shelvectx, basename, opts):
808 """The user might want to unshelve certain changes only from the stored
809 shelve. So, we would create two commits. One with requested changes to
810 unshelve at that time and the latter is shelved for future.
800 def _createunshelvectx(ui, repo, shelvectx, basename, interactive, opts):
801 """Handles the creation of unshelve commit and updates the shelve if it
802 was partially unshelved.
803
804 If interactive is:
805
806 * False: Commits all the changes in the working directory.
807 * True: Prompts the user to select changes to unshelve and commit them.
808 Update the shelve with remaining changes.
809
810 Returns the node of the new commit formed and a bool indicating whether
811 the shelve was partially unshelved.Creates a commit ctx to unshelve
812 interactively or non-interactively.
813
814 The user might want to unshelve certain changes only from the stored
815 shelve in interactive. So, we would create two commits. One with requested
816 changes to unshelve at that time and the latter is shelved for future.
817
818 Here, we return both the newnode which is created interactively and a
819 bool to know whether the shelve is partly done or completely done.
811 820 """
812 821 opts['message'] = shelvectx.description()
813 822 opts['interactive-unshelve'] = True
814 823 pats = []
824 if not interactive:
825 newnode = repo.commit(text=shelvectx.description(),
826 extra=shelvectx.extra(),
827 user=shelvectx.user(),
828 date=shelvectx.date())
829 return newnode, False
830
815 831 commitfunc = getcommitfunc(shelvectx.extra(), interactive=True,
816 832 editor=True)
817 833 newnode = cmdutil.dorecord(ui, repo, commitfunc, None, False,
@@ -861,15 +877,8 b' def _rebaserestoredcommit(ui, repo, opts'
861 877
862 878 with repo.dirstate.parentchange():
863 879 repo.setparents(tmpwctx.node(), nodemod.nullid)
864 if not interactive:
865 ispartialunshelve = False
866 newnode = repo.commit(text=shelvectx.description(),
867 extra=shelvectx.extra(),
868 user=shelvectx.user(),
869 date=shelvectx.date())
870 else:
871 newnode, ispartialunshelve = _dounshelveinteractive(ui, repo,
872 shelvectx, basename, opts)
880 newnode, ispartialunshelve = _createunshelvectx(ui, repo,
881 shelvectx, basename, interactive, opts)
873 882
874 883 if newnode is None:
875 884 # If it ended up being a no-op commit, then the normal
General Comments 0
You need to be logged in to leave comments. Login now