如何处理与 hgsubversion 的合并?

发布于 2024-08-29 07:19:56 字数 354 浏览 6 评论 0原文

我正在尝试为使用 Subversion 的项目做出贡献。我使用 Mercurial 及其 hgsubversion 扩展来克隆存储库。我的工作发生在功能分支上。

如何使功能分支与默认分支(hgspoke)又名主干(svnspoke)上发生的事情保持同步?

因此,我使用 hg up feature 更新到功能分支,然后使用 hg pull 为我提供了默认分支上的变更集。所以我做了hg merge default,提交了合并,然后尝试hg push将我的变更集发送到Subversion。 Mercurial 说:“抱歉,找不到合并修订版的 svn 父级。”

I am trying to contribute to a project that uses Subversion. I used Mercurial and its hgsubversion extension to clone the repo. My work takes place on a feature branch.

How do I keep the feature branch up to date with stuff that happens on the default branch (hg speak) aka the trunk (svn speak)?

So I used hg up feature to update to the feature branch, then hg pull which gave me changesets on the default branch. So I did hg merge default, the committed the merge, then tried hg push to send my changesets to Subversion. And Mercurial said: "Sorry, can't find svn parent of a merge revision."

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

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

发布评论

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

评论(3

旧时模样 2024-09-05 07:19:56

我终于弄清楚了如何在问题中描述的事件发生后让我的存储库解开,这样我就可以继续工作,而不必重新克隆父存储库(这显然是一个相当慢的操作,当你正在从 Subversion 中撤出!)。如果 Subversion 的“提示”超出了您的范围,导致您无法再推动,只需确保您通过 $HOME/.hgrc 行在 Mercurial 中激活了内置的“rebase”扩展,如下所示:

[extensions]
rebase =

然后您应该当你的存储库被楔入时能够运行此命令:

$ hg rebase --svn

如果我理解正确的话,它会解散使你离开 Subversion HEAD 的当前分支,并在 Mercurial 中与 Subversion 中的 HEAD 相对应的分支“tip”上重建它。从那里,您可以继续工作并再次成功进行推送。到目前为止,它一直对我有用;如果您遇到任何问题,请告诉我!

I have finally figured out how to get my repository un-wedged after an event like that described in the question, so that I can continue work without having to re-clone the parent repository (which is, obviously, a quite slow operation when you are pulling from Subversion!). If the "tip" of Subversion outruns you so that you cannot push any more, just make sure that you have the built-in "rebase" extension activated in your Mercurial through a $HOME/.hgrc line like this:

[extensions]
rebase =

And then you should be able to run this command when your repository gets wedged:

$ hg rebase --svn

If I understand this correctly, it dissolves your current branch that has taken you away from Subversion HEAD, and rebuilds it atop the branch "tip" in Mercurial that corresponds to the HEAD in Subversion. From there, you can keep working and successfully do pushes again. It has always worked for me so far; let me know if you run into any problems!

々眼睛长脚气 2024-09-05 07:19:56

Mercurial 有几种不同的分支模式: http:// /stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

您所描述的是“命名分支”,这是您使用时最流行的只能通过 Mercurial(或 hg-git)访问的存储库。

但是,当您使用 hg-subversion 以便将更改推送到 subversion 或从 subversion 推送更改时(名义上只有分支),您最好将所有 Mercurial 更改保留在“默认”命名分支中,并使用“克隆和分支”模式(无论如何我更喜欢)。

具体来说,该消息 Sorry, can't find svn Parent of a merge revision. 不是在 subversion 中直接匹配的修订版本的后代。

如果我是你,我会从 svn 重新克隆,然后使用“移植”命令(打包扩展)将我的工作移到该存储库的“默认”分支中。如果您想要与 hg-subversion 并行使用多个功能,请使用单独的克隆(它们非常便宜),因为它更符合 subversion 对分支的看法。

Mercurial as a few different branching modes: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

The one you're describing is 'named branches', which is the most popular when you're working with a repo that's accessed only via mercurial (or hg-git).

However, when you're using hg-subversion so that you're pushing changes to/from subversion, which only nominally has branches, you're better off keeping all of your mercurial changes in the 'default' named branch, and using the 'clones and branches' pattern (which I prefer anyway).

Specifically, that message Sorry, can't find svn parent of a merge revision. isn't a descendant of a revision that has a direct match in subversion.

Were I you, I'd reclone from svn, and then move my work into that repo's 'default' branch with the 'transplant' command (packaged extension). If you want multiple features in parallel w/ hg-subversion use separate clones (they're so cheap), as it's more in line with how subversion thinks about branches.

夏了南城 2024-09-05 07:19:56

我需要自己弄清楚这一点,并将其写在这里:

http://notebook.3gfp.com/2010/05/pushing-a-new-feature-from-a-mercurial-repo-into-an-svn -repo/

我还没有弄清楚如何在 subversion 中关闭分支并使 Mercurial 图表看起来正确。

I needed to figure this out for myself and wrote it up here:

http://notebook.3gfp.com/2010/05/pushing-a-new-feature-from-a-mercurial-repo-into-an-svn-repo/

I haven't yet figured out how to close a branch in subversion and have the mercurial graph look correct.

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