Pushing a single change set in Mercurial when multiple is available

I have 5 outgoing changes available for push from my local Mercurial repository, and I only want to push one of them at this time. This set of changes is in the middle of all available.

For example, I have the following versions:

  • 6639
  • 6546
  • 6545
  • 6544
  • 6543

and I just want to press 6545. Any easy way to do this?

+6
source share
3 answers

What you want is impossible. The revision should put the repository in a certain state, but if you can press 6545 and the remote repository, it will not include changes from earlier (not pushed) reverses. This is contrary to the basic design of mercury. What you can do is:

a) distribute diff (patch), which contains the same changes as rev 6545. You can do it with hg diff or in other ways, but applying the patch is not inherently related to your rev 6545: this is a separate revision, which " occurs "to make the same changes. If you are lucky, they can be combined in the future without any problems. Or

b) overwrite your story temporarily (with the mq extension) or permanently (with rebase or other extensions) so that 6545 is placed immediately after the changes have already been made. Then you can click it, like any other revision whose ancestors have already been clicked.

+1
source

You can only click the sequential list of change sets to the required one.

So,

 hg push -r 6545 

presses 6543..6545 .

And you cannot press only 6545 , because without previous changes, their changes do not make sense.

+14
source

You can use the Mercurial Queues extension for this. You may need to enable the mq extension, which is described in detail on the linked page.

You must import all the revisions into the queue, pull them from the stack, and then apply the one you want before clicking, and then apply the rest. Something like that:

 > 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 left your repository with the corrected version of 6545 and pushed (but now with a different version number), and the rest of the changes were applied and were not pushed.

+2
source

All Articles