Subject: Re: git-svn: Finding the svn-URL of the current branch in git

From: Peter Baumann <[email-masked]>
Date: Wed, 8 Aug 2007 21:25:37 +0200

On Wed, Aug 08, 2007 at 08:51:55PM +0200, Matthias Kleine wrote:
> Junio C Hamano wrote:
>> Parents' order and which branch you are on may not have anything
>> to do with each other.  Somebody else may have pulled a while on
>> b, and you might have pulled from him the merge he created by
>> doing so while you are on branch a.
>
> You're right, I didn't think of that. While pondering this I came up with
> another problem: git-svn currently remembers which svn-branch a commit
> belongs to by including this information in the git commit log message.

Thats true.

> This way it is not possible to have one git-commit appear in more than one
> svn branch.

But there is no way that a git commit could appear on several branches
in SVN, because SVN doesn't have the concept of multiple parents. So you
can't have a commit which describes a merge of two branches, because SVN
can't store the 2 parents. But you could have 2 commits which describe
the same state (e.g. same root tree), but are on seperate branches.

t:= commits on trunk
b:= commits on branch 'b'

repo1:
	t    <-trunk
	|
	t
	| \
	t  b <- branch
	| /
	t

But this graph is only local to the committers repo. Another person
using git-svn to track the SVN repo sees this

repo2/SVN repo:

	t     <-trunk
	|
	t
	|
	t  b  <- branch
	| /
	t

So if you do a 'git merge trunk' in repo1 on branch 'branch', git-svn
should produce something like this:

repo2/SVN repo:

trunk->	t  t' <- branch
	|  |
	t  t'
	|  |
	t  b
	| /
	t

The interesting case is what it will produce in *YOUR* repo. There are 2
possibilities:

repo1 (I):				repo1 (II)
	tb   <-trunk <-branch		trunk->	t  b <- branch
	|					|  |
	tb					t  b
	| \					| \|
	t  b <- branch				t  b
	| /					| /
	t					t

(I)  would be nicer, but propably more difficult the way git-svn works now.

(II) would also be possible and more in line what other people importing
     from SVN see.

These are the possible ways to describe the merge of 2 SVN branches.

-Peter