使用新的默认分支名称将 svn 存储库拉/克隆到 hg 中?

发布于 2024-10-11 20:00:35 字数 1580 浏览 5 评论 0原文

我正在分叉一个项目的 SVN 存储库,并且需要集成到我的 Mercurial 存储库中。为了简单起见,我有一个本地 hgsubversion 存储库和一个本地 hg 存储库。然而,mercurial 和 hgsubversion 存储库都使用 default 作为默认分支名称。我的目标是将原始代码和更新放在一个分支上,并将我的代码放在 default 分支上,

但是我还无法做到这一点。

W:\programming\tcsite-svn-test>hg clone http://*HG_SITE*/hg .
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

W:\programming\tcsite-svn-test>hg branch blizzard
marked working directory as branch blizzard

W:\programming\tcsite-svn-test>hg commit

W:\programming\tcsite-svn-test>hg log
changeset:   0:be13a9580df0
branch:      blizzard
tag:         tip
user:        Leon Blakey <[email protected]>
date:        Fri Jan 14 23:44:25 2011 -0500
summary:     Created Blizzard Branch

W:\programming\tcsite-svn-test>hg pull http://*SVN_SITE*/svn/
pulling from http://*SVN_SITE*/svn/
....
pulled 23 revisions
(run 'hg update' to get a working copy)

W:\programming\tcsite-svn-test>hg branch
blizzard

W:\programming\tcsite-svn-test>hg branches
default                       23:93642a8890ab <------
blizzard                       0:be13a9580df0

毫不奇怪,当我在 blizzard 分支中真正需要拉取的提交时,hgsubversion 将它们放入 default 分支中。从文档来看,无法重命名提交来自的分支。

令人沮丧的是,我什至无法想出一种方法在仅从中提取 hgsubversion 存储库的存储库上执行此操作,没有其他任何东西。无论如何,所有提交都与该分支相关联。

对于如何从 SVN 存储库中提取更改并将分支重命名为其他名称,有什么建议吗?

I'm forking a project's SVN repo and need to integrate into my Mercurial repo. To keep things simple I have a local hgsubversion repo and a local hg repo. However both the mercurial and hgsubversion repo uses default as their default branch name. My goal here is to put the original code and updates on one branch and my code on the default branch

However I have yet to be able to do this.

W:\programming\tcsite-svn-test>hg clone http://*HG_SITE*/hg .
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

W:\programming\tcsite-svn-test>hg branch blizzard
marked working directory as branch blizzard

W:\programming\tcsite-svn-test>hg commit

W:\programming\tcsite-svn-test>hg log
changeset:   0:be13a9580df0
branch:      blizzard
tag:         tip
user:        Leon Blakey <[email protected]>
date:        Fri Jan 14 23:44:25 2011 -0500
summary:     Created Blizzard Branch

W:\programming\tcsite-svn-test>hg pull http://*SVN_SITE*/svn/
pulling from http://*SVN_SITE*/svn/
....
pulled 23 revisions
(run 'hg update' to get a working copy)

W:\programming\tcsite-svn-test>hg branch
blizzard

W:\programming\tcsite-svn-test>hg branches
default                       23:93642a8890ab <------
blizzard                       0:be13a9580df0

Not surprisingly, hgsubversion puts pulled commits into the default branch when I really need them in the blizzard branch. From the docs, there is no way to rename the branch that a commit came from.

Frustratingly I can't even come up with a way to do it on a repo with only the hgsubversion repo being pulled from, nothing else. All commits are tied to that one branch no matter what.

Is there any suggestions on how to pull changes from an SVN repo and rename the branch to something else?

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

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

发布评论

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

评论(1

擦肩而过的背影 2024-10-18 20:00:35

您在这里有几个选择。

其一,内置扩展“convert”对于单向转换来说更加灵活,并且可以使用 --branchmap 选项轻松处理此问题。不过,hgsubversion 提供了很好的同步回 svn 的功能,但如果您使用 hg Convert,则不会提供这些功能。

在这种情况下,是否可以改变您的命名方案?对于“从 svn 导入”的情况使用 default 并使用 local 或类似的内容进行本地更改?然后,您可以使用不同的分支名称在代码库上命名独立项目。我过去使用过类似的机制。

编辑:刚刚在 hgsubversion 文档中发现了这一点:

hgsubversion.branch

将转换后的变更集标记为所属
到这个分支,或者,如果未指定,
默认。请注意,这
标准不支持选项
布局克隆。

“标准布局克隆”几乎肯定意味着克隆整个项目,包括 /tags、/branches 和 /tags。 /trunk 以正常的 svn 方式。

如果我理解正确,你应该能够执行类似的操作

hg --config hgsubversion.branch=blizzard clone

不确定是否必须添加 --config每次从 svn 更新时都会出现这一行,但是一点点实验应该可以确认这一点。

如果由于某种原因这不起作用,也可以使用 hgsubversion.branchmap 功能,

You have a few options here.

For one, the builtin extension 'convert' is significantly more flexible for one-way conversions, and can easily handle this using the --branchmap option. However, hgsubversion provides nice features for sync'ing back to svn, which are not provided if you're using hg convert.

In this case, would it be possible to just switch around your naming scheme? Use default for the 'imported from svn' case and use local or something similar for your local changes? You could then name independent projects on the codebase with different branchnames. I've used a similar mechanism in the past.

EDIT: Just caught this in the hgsubversion documentation:

hgsubversion.branch

Mark converted changesets as belonging
to this branch or, if unspecified,
default. Please note that this
option is not supported for standard
layout clones.

"Standard layout clones" almost certainly means cloning an entire project including /tags, /branches & /trunk in the normal svn fashion.

If I understand this correctly, you should be able to do something like

hg --config hgsubversion.branch=blizzard clone <svn-repo/trunk>

Not sure if you have to add that --config line every time you update from svn, but a little experimentation should confirm it.

If that doesn't work for some reason, the hgsubversion.branchmap feature is also available,

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