Alex Rivera | Logout

Subversion not merging changes into renamed files?

Asked 2008-10-09T14:12:48.353
25

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.

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'

Any help is greatly appreciated.

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

svn
Edit
Report

1 Answer

1

It's likely that you'll have to rename them in the branch. Can you merge the revision that renamed them from the trunk to branch? That might save some time. Otherwise, you'll have to rename them in the branch. Then try the merge back to the trunk.

answered 2008-10-09T14:18:26.733

Your Answer