开发者

svn merge problems after cvs2svn migration

开发者 https://www.devze.com 2022-12-18 07:31 出处:网络
Our team had a cvs repository, which we converted to svn via cvs2svn.Our repository has a main 开发者_如何学编程branch (let\'s call in main), that effectively serves as trunk (even though it was techn

Our team had a cvs repository, which we converted to svn via cvs2svn. Our repository has a main 开发者_如何学编程branch (let's call in main), that effectively serves as trunk (even though it was technically branched off from trunk far in the past).

After the cvs2svn conversion, I branched off main to branch.

I made a small change in branch, and then attempted to merge branch back into main:

[~/main] svn merge https:.../branch

This should compute the diff to branch since the split happened, and apply that diff to main. It goes back a couple years too far back, however, leading to a zillion conflicts.

Any ideas on how to fix this? I've scoured Google but can't find anything.

I know that I can call svn merge and pass in the exact revision numbers. I'm looking for a better alternative.


You need to tell svn merge what your merge point is so it knows what range of commits to sync to main. Since you didn't specify a range, it defaults to the range of commits through the HEAD revision. This causes too many revisions.

This will get the previous commit revision that you will be syncing from:

svn log --xml --stop-on-copy https://.../branch | grep 'revision=' | head -n 1 | sed 's/.*revision="\([0-9][0-9]*\)".*/\1/g'

Basically, that gets the first copy revision on the branch (which I'll call "REV"). You'll then merge that to your 'main' copy's HEAD revision (in the main dir):

cd main
svn merge https://.../branch:REV https://.../branch:HEAD .

That should apply all changes from REV through HEAD on the 'branch' copy to the 'main' copy. This should work fine even for repeat merges from branch to main.

Cheers!

0

精彩评论

暂无评论...
验证码 换一张
取 消