Subversion 不将更改合并到重命名的文件中? [英] Subversion not merging changes into renamed files?

查看:33
本文介绍了Subversion 不将更改合并到重命名的文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 subversion 时遇到以下问题:

I have the following problem using subversion:

我目前正在处理我的项目的主干,并计划进行一些重构(包括重命名文件或将文件移动到不同的目录).

I'm currently working on the trunk of my project and plan to do some refactoring (which includes renaming files or moving files to different directories).

与此同时,其他人正在一个分支上从事同一个项目.

At the same time someone else is working on the same project on a branch.

有时我想将在分支上所做的更改合并回主干.这包括对已在主干上重命名的文件(在分支上)所做的更改.

At some time I want to merge the changes made on the branch back to the trunk. That includes changes made to files (on the branch) that have been renamed on the trunk.

我做了一些测试,似乎 subversion 无法遵循这些更改,或者我错过了一些东西(这是我所希望的).我使用以下脚本对此进行了测试(应该在 bash 中工作,假设在 "http://myserver/svn/sandbox"):

I did some tests and it seems that either subversion is not capable of following these changes or I'm missing someting (which is what I hope for). I tested this using the following script (should work in bash, assumes an svn repository at "http://myserver/svn/sandbox"):

svn co http://myserver/svn/sandbox

cd sandbox/

mkdir -p MyProject/trunk MyProject/branches MyProject/tags

cat - <<EOF >MyProject/trunk/FileOne.txt
Test
1
2
EOF

svn add MyProject

svn commit -m "init"

# create a branch
svn copy http://myserver/svn/sandbox/MyProject/trunk http://myserver/svn/sandbox/MyProject/branches/Branch_1 svn copy http://myserver/svn/sandbox/MyProject/trunk http://myserver/svn/sandbox/MyProject/branches/Branch_1

# rename the file
svn move MyProject/trunk/FileOne.txt MyProject/trunk/FileTwo.txt

svn commit -m "renamed file"

svn update 

# change the content of FileOne in branch

cat - <<EOF >MyProject/branches/Branch_1/FileOne.txt
Test
2
3
EOF

svn commit -m "changed branch"

# I now try to merge the changes in FileOne back to FileTwo
cd MyProject/trunk/
svn merge -r1:HEAD http://myserver/svn/sandbox/MyProject/branches/Branch_1
# but this yields the following message:
# Skipped missing target: 'FileOne.txt'

非常感谢任何帮助.

也许 mikegrb 建议的过程可以通过首先从主干上的 svn log 命令生成重命名文件(旧->新)的映射而在某种程度上自动化:

Perhaps the process suggested by mikegrb could by somewhat automated by first generating a map of renamed files (old->new) from the svn log command on the trunk:

svn log -v
------------------------------------------------------------------------
r33 | sme | 2008-10-09 15:17:54 +0200 (Do, 09 Okt 2008) | 1 line
Changed paths:
   D /MyProject/trunk/FileOne.txt
   A /MyProject/trunk/FileTwo.txt (from /MyProject/trunk/FileOne.txt:31)


resulting map: {FileOne.txt => FileTwo.txt}

现在使用此映射更改分支上生成的补丁文件中的文件名.

Now use this map to change filenames in the patch file generated on the branch.

原文:

Index: FileOne.txt
===================================================================
--- FileOne.txt (.../trunk)     (revision 31)
+++ FileOne.txt (.../branches/Branch_1) (revision 34)
@@ -1,3 +1,3 @@
 Test
-1
 2
+3

修改:

Index: FileTwo.txt
===================================================================
--- FileTwo.txt (.../trunk)     (revision 31)
+++ FileTwo.txt (.../branches/Branch_1) (revision 34)
@@ -1,3 +1,3 @@
 Test
-1
 2
+3

只是一个想法,还没有实现.

Just an Idea, haven't done it yet.

推荐答案

我认为这是一个现有的颠覆 bug - 但不要屏住呼吸,它自 2002 年就开放了.

I think this is an existing subversion bug - but don't hold your breath, its been open since 2002.

这篇关于Subversion 不将更改合并到重命名的文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆