views:

42

answers:

1

In the answer to this question, Ry4an states that "you cannot push Changeset2 without pushing Changeset1".

This certainly makes sense if the repository looks like this:

+ Changeset2
|
+ Changeset1
|
+ Original

However it doesn't seem to make as much sense in the following scenario, which is what I currently have:

+ Changeset2
|
|   + Changeset1
|  /
| /
+ Original

Ideally, I want to be able to push just Changeset2 back to the repository I initially cloned from. Mercurial doesn't seem willing to let me do that. It's insisting I push Changeset 1 also... which is not allowed as it would create a new head in the original repository. Obviously I could "Cherry pick", or create a patch to apply on the original repository but that seems clunky. Am I missing something?

Update: I should probably have mentioned in my initial question that I was trying to perform the operation from the TortoiseHg GUI. As Niall C. correctly identified in his answer, the Mercurial command line allowed me to accomplish what I needed, however I would still be interested in learning if there is any way to accomplish the same operation from the GUI.

+5  A: 

If you're using hg push without any command-line option, it will try to push every changeset in your local repository that doesn't exist in the remote repository. If you use the -r / --rev option, it will just push that revision and its ancestors. In your case, you would need to do:

hg push --rev Changeset2

See hg help push for full details.

Niall C.
Excellent! I was sure I must be missing something and that was it.
Richard J Foster
Check out Steve Losh's `hg nudge` command (http://hgtip.com/tips/advanced/2009-09-28-nudge-a-gentler-push/). It's the same idea, but he has some nice explanations and workflows you can use with it.
tghw