开发者

In Mercurial, is there any way (aside from "Cherry picking") to push a changeset without also pushing changesets associated with a different head?

开发者 https://www.devze.com 2023-01-20 20:06 出处:网络
In the answer to this question, Ry4an states that \"you cannot push Changeset2 without pushing Changeset1\".

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 comman开发者_如何学Cd 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.


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.


For the UI lovers who like pictures:

  1. In TortoiseHg click on Detect outgoing changes to button.

    In Mercurial, is there any way (aside from "Cherry picking") to push a changeset without also pushing changesets associated with a different head?

  2. Click right mouse button on revision you want to push.

  3. Choose Push -> Push to Here.

    In Mercurial, is there any way (aside from "Cherry picking") to push a changeset without also pushing changesets associated with a different head?

Result: You will push only revision selected rather than everything.

In Mercurial, is there any way (aside from "Cherry picking") to push a changeset without also pushing changesets associated with a different head?

Hope this saves you some time.

0

精彩评论

暂无评论...
验证码 换一张
取 消