views:

842

answers:

1

I am evaluating git-svn and trying to determine how well it will play with a particular svn repository. I am mostly concerned with getting git-svn to perform merges in such a way that the svn:mergeinfo property is correctly set in the subversion repo. Is this possible?

Here is what I have done so far:

# Checkout the SVN repo.
$ git svn clone svn://server/project1 -T trunk -b branches -t tags

# Make sure we are working on trunk.
$ git reset --hard remotes/trunk

# Modify the working copy.
$ vim file.txt

# Commit locally to the git repo.
$ git commit -a

# Push the commits back to the SVN server.
$ git svn dcommit
Committing to svn://server/project1/trunk ...
    M   file.txt
Committed r178
    M   file.txt
r178 = b6e4a3a0c28e7b9aa71d8058d96dcfe7c8a2b349 (trunk)

Now how would I go about merging that particular commit into one of the subversion branches? Again, it is very important to me that git properly set the svn:mergeinfo property when committing the change.

+8  A: 

Short answer: No, git-svn does not care about svn:mergeinfo properties since git-svn is not doing merges back to svn (it is doing commits).

Long answer: Most people use git-svn to get out of the brain-damaged merging of svn. The problem with svn is that it does not differentiate between copying files or folders (often caused by refactoring) and creating a branch since creating a branch or tag is done by using the "svn copy" command. The svn:mergeinfo property is a band-aid on this problem but there are still cases where modifications are ambiguous. Git has much more robust support for branching and merging.

Mike Hopper
The long answer is inaccurate for recent versions of SVN (1.5+). SVN _does_ differentiate between refactorings and branching exactly via `svn:mergeinfo` property. There are edge cases where it may not work, but that's not the reason why basic branch/merge couldn't be supported.
porneL
Like I said, svn:mergeinfo is a band-aid. Svn will always be weak in the area of branching until it has a dedicated "branch" command. I suffered through countless hours using SVN 1.5 and having to manually remove bogus mergeinfo property data when merging changes from hundreds of files across multiple branches. SVN just doesn't have enough information in its metadata to make the right decisions. Usually we got merge conflicts even when there really wasn't a conflict. Git is so much easier and more powerful!
Mike Hopper
Exactly.I can't tell how happy I am after moving my project to git. The countless hours spent on resolving svn conflicts are no longer there - we now spend time on resolving conflicts that really make sense.
yclian