views:

82

answers:

3

I have trouble where, for some reason, SVN would only merge the newly generated template code to implemented code (thus overwriting whatever I had done), but not the other way around.

For example,

1) I generate a file called SomeFile.java. I commit this to trunk. I also branch this to feat1/SomeFile.java

2) I work off of the feat1/SomeFile.java (the branch). Once everything is okay, I simply commit to feat1 branch, and reintegrate to the trunk.

3) Now I need to re-generate the code again (with some changes). What I did before was I committed this to the trunk, then I tried to merge from feat1 branch to trunk. BUT for some reason SVN would not merge the files at all.

Am I doing something wrong?

A: 

I often do automatic merges. What i do is very low tech. I generate a patch file of the differences then apply them later.

I use a variation of patch tools for windows. I have noticed that windiff, tortoisesvn and just about any diffing tool can apply patch files using command line options.

(probably should close this question as a duplicate of superuser.com post)

Andrew Keith
@Andrew, you could check my update if you would like, and see if I'm doing something wrong.
ShaChris23
+1  A: 

I think reintegrate is not what you want.

Try a normal merge. In your trunk:

svn merge [url]/feat1
Alex Neth
thanks. i will give it a try, and let you know.
ShaChris23
wow..that was easy. thanks. Would you be so kind as to tell me doing the equivalent using TortoiseSVN?
ShaChris23
Sorry, I'm a command line Mac guy. No idea about TortoiseSVN. Merging without specifying revisions (letting the system keep track of what has been merged) is a pretty new feature of Subversion though, so it might not be supported that well in an older graphical client. Since Tortoise is so popular I would think there's a way.
Alex Neth
A: 

I would recommend reading the chapter on Branching and Merging in the SVN book.

From the steps you described it seems to me you are merging multiple times from a branch to the trunk, which might not be a good idea or (as in your case) might not work at all.

Before you reintegrate the branch into the trunk, you should merge from the trunk to the branch. This will ensure that the only difference between the trunk and the branch is the changes you made in the branch. Then you reintegrate the changes from the branch into the trunk. Trunk and branch should now be at the same revision level.

In step 3 it sounds like you make changes to the trunk, commit these changes and then merge from the branch to the trunk again. The changes from the branch have already been merged in step 2 so SVN will not merge again.

cschol