使用 Mercurial,如何将默认更改更改为命名分支?

发布于 2024-10-13 05:33:41 字数 555 浏览 8 评论 0原文

我有一个中央 Mercurial 存储库,其中包含使用 hgsubversion 从 SVN 存储库克隆的历史记录。自从克隆原始 hg 存储库以来,我已经提取了对 SVN 存储库所做的额外提交;这些当前位于默认分支中。

我也有一个命名的分支。我已将此分支(使用 hg clone -b mybranch)克隆到我的本地系统。现在我想获取仅存在于默认情况下的更改,并使它们在我的命名分支中可用。我认为最明显的方法是在存储库上执行 hg update mybranch ,然后 hg merge default 并提交。这看起来很危险——如果我忘记在完成后更新回默认值,所有未来从 SVN 的拉取都会将更改拉入mybranch

我还考虑过,也许我在克隆存储库时不应该指定 mybranch,而是克隆整个存储库并在本地更新为 mybranch。因此,我可以将默认的更改拉到本地克隆并在那里进行合并。

这里的正确答案是什么?在共享存储库上执行此操作并且要小心吗?克隆所有内容并在本地管理分支?或者我缺少更简单的解决方案吗?

I have a central Mercurial repository containing a history cloned from a SVN repository using hgsubversion. I have pulled the additional commits made to the SVN repository since the original hg repo was cloned; these are currently in the default branch.

I also have a named branch. I have cloned this branch (using hg clone -b mybranch) to my local system. Now I want to grab the changes that exist only in default and make them available in my named branch. The obvious way I see to do it is to do a hg update mybranch on the repo, then hg merge default and commit. This seems perilous--if I forget to update back to default after I'm done, all future pulls from SVN will pull changes into mybranch.

I have also considered that perhaps I should not have specified mybranch when I cloned the repo, but cloned the entire repo and just updated to mybranch locally. Thus I could pull the changes in default to my local clone and do the merge there.

What's the right answer here? Do it on the shared repo and just be careful? Clone everything and manage branches locally? Or is there an easier solution I'm missing?

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

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

发布评论

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

评论(2

篱下浅笙歌 2024-10-20 05:33:41

一般来说,对于 Mercurial,每当我做一些我认为可能会导致问题的事情时,我都会克隆存储库并在那里进行尝试。然后我可以选择将这些更改推回或在真实存储库上执行操作。不管怎样,我都可以选择失败而不造成任何损害。 克隆可以被扔掉,如果你搞砸了,你不必保留它们。

In general with Mercurial, anytime that I do something that I think might cause issues, I clone the repo and try it out there. Then I can either choose to push those changes back in or perform the action on the real repository. Either way I have the option of failing and not causing any damage. Clones can be thrown away, you don't have to keep them around if you screwed up.

不离久伴 2024-10-20 05:33:41

在共享存储库中执行此操作并小心。或者克隆整个共享存储库,在那里进行合并,然后推送到仅分支克隆。

Do it in the shared repo and be careful. Or clone the entire shared repo, do the merge there, and then push to the branch-only clone.

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