cvs2svn 和合并信息

发布于 2024-07-14 10:07:35 字数 1136 浏览 5 评论 0原文

我想使用 cvs2svn 将 CVS 项目转换为 Subversion。 它有一个主干(HEAD),以及从主干创建的几个临时开发分支。

在转换之前,我们会将主干中的最新更改合并到所有开发分支中。 但它们也会有尚未合并回主干的更改。

当我将项目转换为 SVN 时,它不会有任何合并历史记录属性。 那么我如何初始化这些属性,以便随后可以与分支合并?

换句话说,转换后,主干和任何给定分支之间都会存在许多差异。 下次我从主干合并到分支时,我不想将这些差异视为需要合并的更改。 但是当我从分支合并到主干时,我就这么做了。 这可能吗?

更新:我采纳了mhagger的建议,并告诉SVN分支已经从主干合并了所有更改:

svn co [branch URL] .
svn merge --record-only [trunk URL]
svn commit -m ''

这有效,所以下次我尝试从主干合并到分支时,它显示没有新的变化。

但我仍然对 --reintegrate 合并有问题,从分支回到主干。 它最终显示了很多“R”替换的文件,这意味着主干有一个文件X,分支有一个文件X,但它们不被认为是同一个文件。 这使得合并有点混乱,尽管它最终似乎得到了正确的结果。

我认为发生这种情况是因为以下事件顺序:

  • 创建了分支(在 CVS 中)
  • 文件 X 被添加到主干(在 CVS 中)
  • X 被合并到分支(也在 CVS 中)
  • 项目被转换为 Subversion
  • Subversion 没有'我不知道branch/X是从trunk/X复制的。 所以 认为这是一个替代品。

SVN 历史记录看起来像这样:

r100: create branch (copied from trunk)
r200: add trunk/X
r300: add branch/X (because of a CVS merge, but it's not a SVN copy)

那么,有没有办法让我告诉 Subversion 忽略这些文件' 进行 --reintegrate 合并时的祖先? 或者有更好的方法来转换这些文件?

I want to convert a CVS project to Subversion, using cvs2svn. It has a main trunk (HEAD), with several temporary development branches created from the trunk.

Before we convert it, we'll merge the latest changes from the trunk into all of the dev branches. But they will also have changes that haven't been merged back into the trunk yet.

When I convert the project to SVN, it won't have any of the merge-history properties. So how can I initialize those properties, so I can subsequently merge to and from the branches?

In other words, after the conversion, there will be a number of differences between the trunk and any given branch. The next time I merge from the trunk into the branch, I don't want to see those differences as changes that need to be merged. But when I merge from the branch into the trunk, I do. Is this possible?

UPDATE: I took mhagger's suggestion, and told SVN that the branches had all changes already merged in from the trunk:

svn co [branch URL] .
svn merge --record-only [trunk URL]
svn commit -m ''

This works, so the next time I try to merge from the trunk into a branch, it shows no new changes.

But I still have a problem with --reintegrate merges, from the branch back to the trunk. It ends up showing a lot of "R"eplaced files, meaning that the trunk has a file X, and the branch has a file X, but they're not considered the same file. This makes the merge kind of messy, although it seems to end up with the right results.

I think this happens because of the following sequence of events:

  • Branch was created (in CVS)
  • A file X was added to the trunk (in CVS)
  • X was merged into the branch (also in CVS)
  • Project was converted to Subversion
  • Subversion didn't know that branch/X was copied from trunk/X. So it
    thinks it's a replacement.

The SVN history looks something like this:

r100: create branch (copied from trunk)
r200: add trunk/X
r300: add branch/X (because of a CVS merge, but it's not a SVN copy)

So, is there a way for me to tell Subversion to ignore the files'
ancestry when doing a --reintegrate merge? Or a better way to convert these files?

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

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

发布评论

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

评论(2

染墨丶若流云 2024-07-21 10:07:35

您可能知道,cvs2svn 不会生成任何合并元数据,除了有关分支从何处萌芽的隐式信息。 (它不能,因为 CVS 不记录此类信息。)因此,转换后,您必须明确告知 Subversion 有关在 CVS 下完成的合并。

最简单的方法是使用“svn merge --record-only ...”,如 Subversion 书籍

As you probably know, cvs2svn does not generate any merge metadata, except for the implicit information about where branches sprouted from. (It cannot, because CVS doesn't record such information.) So, after the conversion, you will have to explicitly tell Subversion about merges that were done under CVS.

The easiest way to do that is by using "svn merge --record-only ...", as described in the Subversion book.

剩余の解释 2024-07-21 10:07:35

好的,我想我有一个解决上述 --reintegrate 问题的方法,以防有人感兴趣。

根据 此文档,如果我已合并将最新版本的主干添加到分支中,执行 --reintegrate 与对主干执行此操作本质上相同:

svn merge [trunk URL] [branch URL]

但是此语法允许 --ignore-ancestry,而 --reintegrate 则不允许。 所以我可以这样做:

svn merge --ignore-ancestry [trunk URL] [branch URL]

这显示了与 --reintegrate 相同的结果,没有所有“R”替换的文件。 唯一的其他区别似乎是 mergeinfo 属性。 我不确定这些是否正确,因此最好之后删除分支,就像 --reintegrate 之后一样。

OK, I think I have a workaround for the --reintegrate problem above, in case anyone's interested.

According to this document, if I've merged the latest version of the trunk into the branch, doing a --reintegrate is essentially the same as doing this to the trunk:

svn merge [trunk URL] [branch URL]

But this syntax allows --ignore-ancestry, which --reintegrate doesn't. So I can do:

svn merge --ignore-ancestry [trunk URL] [branch URL]

That shows me the same results as a --reintegrate, without all the "R"eplaced files. The only other difference seems to be the mergeinfo properties. I'm not sure whether these will be correct, so it's probably best to delete the branch afterwards, just like you would after a --reintegrate.

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