在 Mercurial 中,是否有任何方法(除了“樱桃采摘”之外)来推送变更集而不同时推送与不同头相关的变更集?
在此问题的答案中,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用不带任何命令行选项的
hg push
,它将尝试推送本地存储库中远程存储库中不存在的每个变更集。如果您使用-r
/--rev
选项,它只会推送该修订版及其祖先。在您的情况下,您需要执行以下操作:请参阅
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:See
hg help push
for full details.对于喜欢图片的 UI 爱好者:
在 TortoiseHg 中单击
检测传出更改
按钮。在要推送的修订上单击鼠标右键。
选择
推送 ->推送到此处
。结果:您将仅推送选定的修订版本,而不是所有内容。
希望这可以为您节省一些时间。
For the UI lovers who like pictures:
In TortoiseHg click on
Detect outgoing changes to
button.Click right mouse button on revision you want to push.
Choose
Push -> Push to Here
.Result: You will push only revision selected rather than everything.
Hope this saves you some time.