在 Mercurial 中,是否有任何方法(除了“樱桃采摘”之外)来推送变更集而不同时推送与不同头相关的变更集?

发布于 2024-09-28 11:16:26 字数 888 浏览 2 评论 0原文

此问题的答案中,Ry4an 指出“如果不推送 Changeset1,则无法推送 Changeset2”。

如果存储库看起来像这样,这当然是有意义的:

+ Changeset2
|
+ Changeset1
|
+ Original

但是,在以下场景中,这似乎没有多大意义,这就是我目前所拥有的:

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

理想情况下,我希望能够将 Changeset2 推回存储库我最初克隆自。 Mercurial 似乎不愿意让我这么做。它坚持我也推送 Changeset 1...这是不允许的,因为它会在原始存储库中创建一个新头。显然我可以“挑选”,或者创建一个补丁来应用到原始存储库,但这看起来很笨重。我错过了什么吗?

更新:我应该在最初的问题中提到我试图从 TortoiseHg GUI。作为Niall C。在他的回答中正确指出,Mercurial 命令行允许我完成我需要的操作,但是我仍然有兴趣了解是否有任何方法可以从 GUI 完成相同的操作。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抚笙 2024-10-05 11:16:26

如果您使用不带任何命令行选项的hg push,它将尝试推送本地存储库中远程存储库中不存在的每个变更集。如果您使用 -r / --rev 选项,它只会推送该修订版及其祖先。在您的情况下,您需要执行以下操作:

hg push --rev Changeset2

请参阅 hg help push 了解完整详细信息。

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.

忆悲凉 2024-10-05 11:16:26

对于喜欢图片的 UI 爱好者:

  1. 在 TortoiseHg 中单击检测传出更改按钮。
    输入图片此处描述

  2. 在要推送的修订上单击鼠标右键。

  3. 选择推送 ->推送到此处
    输入图片此处描述

结果:您将仅推送选定的修订版本,而不是所有内容。
输入图片此处描述

希望这可以为您节省一些时间。

For the UI lovers who like pictures:

  1. In TortoiseHg click on Detect outgoing changes to button.
    enter image description here

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

  3. Choose Push -> Push to Here.
    enter image description here

Result: You will push only revision selected rather than everything.
enter image description here

Hope this saves you some time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文