如何使用 Mercurial 自动合并 2 个头
我们刚刚从 subversion 切换到 Mercurial,有一件事比预期花费了更多的时间;合并头。
我们喜欢这样一个事实:它使合并独立于 2 个提交(与 subversion 相比),但我们最终会定期合并 2 个头以进行不相关的更改。
简单的场景。 我和鲍勃都了解最新情况。 我们都在默认(也称为主)分支上更新了 ou 仓库,并在不同的文件中进行了改进。
我们承诺,只有一台能够推送到中央服务器,另一台将创建 2 个头。然后,拉,选择 2 个头,合并(这会很容易,因为更改是在不同的文件上)。承诺,然后推动。
因此,是否有一个扩展可以执行这些步骤 尝试合并 如果没有冲突的话 犯罪 别的 取消合并
我们希望在自动服务器上运行此操作,因此如果这是命令行则+1,如果它可以在不接触工作副本的情况下进行合并,则另一个+1。
谢谢!
更新:
我们最终做了一些 python 脚本来管理最常见的任务(合并和构建;合并 2 个头)。
感谢您的帮助!
We just changed over to mercurial from subversion and there is one thing that is taking up more time than expected; merging heads.
We love the fact that it keeps merges independent from the 2 commits (compared to subversion) but we end up on a regular basis merging 2 heads for unrelated changes.
Simple scenario.
Both me and Bob are up to date.
We both have ou repo up to date on default (aka main) branch and do improvement in different files.
We commit and only one will be able to push to the central server, the other one will create 2 heads. Then, pull, select 2 heads, merge (it will go easily since changes are on different files). Commit, then push.
Therefore, is there an extension that does these steps
Attempt merge
If no conflicts
Commit
else
Cancel merge
We are looking to have this run on an automated server, so +1 it this is command line and another +1 if it can do the merge without touching the working copy.
Thanks!
Update:
We ended up doing a few python scripts to manage the most common tasks (merge up & build; merge 2 heads).
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您应该能够使用
hg fetch
来实现此目的。它将从服务器提取更改、合并,然后自动提交合并。它也会提示合并冲突。它包含在 Mercurial 中,因此只需添加到您的 hgrc 中,您就应该完成所有设置。它不会自动推送,但这通常是一个坏主意。在将代码推送给其他人之前,您通常需要运行测试并解决任何合并问题。
It sounds like you should be able to use
hg fetch
for this. It'll pull the changes from the server, merge, and then automatically commit the merge. It does prompt for merge conflicts as well. It's included with Mercurial, so just addto your hgrc, and you should be all set. It doesn't automatically push, but that's usually a bad idea anyway. You would typically want to run tests and resolve any merge problems before pushing your code out to everyone else.
合并真的需要那么多时间吗?如果它们是“无关的变化”,那不是只需要眨眼的时间吗?
有人已经建议
fetch
,其他人可能会建议rebase
,但我个人认为合并是编码,并希望它是手动的。它几乎不需要时间,而且是一个传达好消息的机会,例如“在我的 FooBar 工作中拉入 Jane 的工作”(而不是 fetch 提供的无用的提交消息)。Are the merges really taking that much time? If they're "unrelated changes" doesn't it just take a blink?
Someone already suggested
fetch
and someone else will probably suggestrebase
, but personally I consider merging to be coding, and want it to be manual. It takes almost no time and it's an opportunity to give a good message like "Pulling in Jane's work half-way through my FooBar work" (instead of the useless commit messages fetch provides).