Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing single changeset in Mercurial when multiple are available

Tags:

mercurial

I have 5 outgoing changesets available to push from my local Mercurial repo, and I only want to push one of these at this time. This one changeset lies in the middle of all available.

For example I have the following revisions:

  • 6639
  • 6546
  • 6545
  • 6544
  • 6543

and I only want to push 6545. Any easy way to do this?

like image 623
earthling Avatar asked Oct 25 '12 21:10

earthling


2 Answers

You can only push the consecutive list of changesets up to the required.

So

hg push -r 6545

will push 6543..6545.

And you cannot push just 6545 because without preceding changesets its changes make no sense.

like image 121
zerkms Avatar answered Sep 26 '22 01:09

zerkms


You could use the Mercurial Queues extension to do this. You may need to enable the mq extension which is detailed on the linked page.

You would import all the revisions into the queue, pop them all off the stack and then apply the one that you want before pushing and then applying the rest. Something like this:

> hg qimport --rev 6639
> hg qimport --rev 6543:6546
> hg qpop --all
> hg qpush --move 6545.diff

Here you might have to resolve conflicts

> hg qfinish --applied
> hg push
> hg qpush --all

Again, might need to resolve conflicts here.

This has left your repository with revision 6545 applied and pushed (but with a different revision number now) and the rest of your changes applied and not pushed.

like image 23
Steve Kaye Avatar answered Sep 27 '22 01:09

Steve Kaye