Subversion 在移动后无法合并

发布于 2024-08-18 13:19:44 字数 695 浏览 10 评论 0原文

我对 Subversion 很陌生,但多年来我一直在使用其他版本控制系统(例如 ClearCase)。

我的老板要求我修复这个项目,以便可以使用 Maven 而不是 Ant 来构建它。我必须做的重要事情之一是将 src/com 移动到 src/main/java/com,并移动 test/com > 到 src/test/java/com,这是我使用 svn mv 命令完成的。我愚蠢地认为,既然我使用 Subversion 命令来移动目录,那么 Subversion 就会知道东西已经被移动了。当我将分支合并到主干时,它似乎起作用了。但现在其他人刚刚完成了他在我工作之前分支的一个分支的工作。所以我们将他的东西合并到主干中,基本上 Subversion 似乎认为“好吧,他对 src/com/foo/bar/baz.java 进行了更改,但该目录没有”不再存在,所以它无关紧要,所以丢弃它“而不是我所期望的,这是“好吧,他对src/com/foo/bar/baz.java<进行了更改/code>,但 src/com 已被移动,所以我需要将其合并到 src/main/java/com/foo/bar/baz.java”< /em>.

有没有办法让 Subversion 进行修订管理,或者我是否要在接下来的两天内手动合并这个人的更改?

I'm very new to Subversion, but I've used other revision control systems like ClearCase for years.

My boss asked me to fix this project so that it could be built with Maven instead of Ant. One of the important things I had to do to was to move src/com to src/main/java/com, and move test/com to src/test/java/com, which I did using the svn mv command. I foolishly assumed that since I used Subversion commands to move the directories, that Subversion would then know that things had been moved. And when I merged my branch into the trunk, it appeared to work. But now somebody else just finished work on a branch that he branched off before my work. So we go to merge his stuff into trunk, and basically Subversion appears to think “ok, he made changes to src/com/foo/bar/baz.java, but that directory doesn’t exist any more, so it’s irrelevant, so discard it” instead of what I expected, which was “ok, he made changes to src/com/foo/bar/baz.java, but src/com has been moved, so I need to merge that into src/main/java/com/foo/bar/baz.java.

Is there a way to make Subversion do the revision management, or am I going to be manually merging this guy’s changes for the next two days?

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

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

发布评论

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

评论(4

海的爱人是光 2024-08-25 13:19:44

直接回答你的问题:

有没有办法让 Subversion 进行修订管理,或者我是否要在接下来的两天内手动合并这个人的更改?

您应该能够让自己变得更轻松一些。

您可以做一件事来减轻一些痛苦(假设布局如下)

/branch/foo/src/com
/branch/foo/test/com
/trunk/src/main/java/com
/trunk/src/test/java/com

在将 src/com 移动到 src/main/java/com 并将 test/com 移动到 src/test/java/com 之前,您可以这样做:

cd $TRUNK
svn merge -r N:M http://server/branch/foo .

您现在可以做的是:

cd $TRUNK
svn merge -r N:M http://server/branch/foo/src/com src/main/java/com
svn merge -r N:M http://server/branch/foo/test/com src/test/java/com

希望这有助于节省您一些时间。

To answer your question directly:

Is there a way to make Subversion do the revision management, or am I going to be manually merging this guy’s changes for the next two days?

You should be able to make it a little bit easier on yourself.

One thing that you can do to alleviate some of the pain (assuming a layout as follows)

/branch/foo/src/com
/branch/foo/test/com
/trunk/src/main/java/com
/trunk/src/test/java/com

Before you moved src/com to src/main/java/com and test/com to src/test/java/com you could have done:

cd $TRUNK
svn merge -r N:M http://server/branch/foo .

What you could do now is:

cd $TRUNK
svn merge -r N:M http://server/branch/foo/src/com src/main/java/com
svn merge -r N:M http://server/branch/foo/test/com src/test/java/com

Hope this helps to save you some time.

给我一枪 2024-08-25 13:19:44

这听起来像是一个一次性问题。我建议你可以使用 svn diff > /to/some/file.patch (或普通 diff)将其更改保存到文件中,然后使用 patch -p0 将其应用到移动的主干上。 /to/some/file.path

This sounds like a one-time problem. I suggest you could use svn diff > /to/some/file.patch (or normal diff) to save his changes to a file, then apply it on your moved trunk with patch -p0 < /to/some/file.path.

沩ん囻菔务 2024-08-25 13:19:44

有人试过这个软件吗? xMerge

这是 SmartSVN 的插件,但看起来确实如此窍门。
如果有人正在使用它,请给我发送评论,我将不胜感激。

Anyone tried this software? xMerge

This is plugin to SmartSVN but looks like it do the trick.
If anyone is using it I will be grateful if send me review of it.

做个少女永远怀春 2024-08-25 13:19:44

我刚刚遇到了同样的问题,我用 git 解决了它。我不想使用 svn merge -r N:M http://server/branch/foo/test/com src/test/java/com for src/ 合并多个模块main、src/testresources

所以我使用了 git svn clone file:///some/repo -T trunk -b Branchs -t Tags。像这样,我能够使 git mastersvn trunk 保持同步,并将其与我的 git 分支 合并。完成后,我将git分支合并到git master,然后从那里合并到svn trunk

I just had the same problem and I solved it with git. I didn't want to merge serveral modules with svn merge -r N:M http://server/branch/foo/test/com src/test/java/com for src/main, src/test and resources.

So I used git svn clone file:///some/repo -T trunk -b branches -t tags. Like this I was able to keep git master in sync with svn trunk and merge it with my git branch. When I was done, I merged the git branch to git master and from there to svn trunk.

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