# git-svn with non-standard repository layout

6 messages from 2012-12-04 to 2012-12-11. Participants: Piotr Krukowiecki, Stephen Bash.
Thread: https://gitlist.dev/t/32268

## Piotr Krukowiecki, 2012-12-04 17:29

Subject: git-svn with non-standard repository layout
Message-ID: <CAA01CspaYewmhTcYCWscsOWoNPvb6a=G1Ak0-=_spJSh6fsdHg@mail.gmail.com>
URL: https://gitlist.dev/e/CAA01CspaYewmhTcYCWscsOWoNPvb6a%3DG1Ak0-%3D_spJSh6fsdHg%40mail.gmail.com

```
Hi,

Is there a way to handle svn repository with following layout?

repo/trunk
repo/branches/branch1
repo/branches/branch2
repo/branches/work/developer1/branch3
repo/branches/work/developer1/branch4
repo/branches/work/developer2/branch5

In default configuration it treats "work" dir as a branch. If I
configure it with branches = branches/work/*/* it recognizes them
correctly, but then the "normal" branch1, branch2 are lost.

Ideally, I'd have one git repo with trunk, branches/{branch1,branch2},
work/developerX/branchY branches...

Any ideas?

--
Piotr Krukowiecki

```

## Piotr Krukowiecki, 2012-12-05 16:26

Subject: Re: git-svn with non-standard repository layout
Message-ID: <CAA01Csoam7pXqPKnjvJB46T_sdjcW2S1oXdQT3HbUdfN4TK0kw@mail.gmail.com>
URL: https://gitlist.dev/e/CAA01Csoam7pXqPKnjvJB46T_sdjcW2S1oXdQT3HbUdfN4TK0kw%40mail.gmail.com
In-Reply-To: <50BE68C9.7070100@cafu.de>

```
On Tue, Dec 4, 2012 at 10:19 PM, Carsten Fuchs <carsten.fuchs@cafu.de> wrote:
> Hi Piotr,
>
> Am 2012-12-04 18:29, schrieb Piotr Krukowiecki:
>
>> Is there a way to handle svn repository with following layout?
>>
>> repo/trunk
>> repo/branches/branch1
>> repo/branches/branch2
>> repo/branches/work/developer1/branch3
>> repo/branches/work/developer1/branch4
>> repo/branches/work/developer2/branch5
>
> see my post at
>     http://www.cafu.de/forum/viewtopic.php?f=14&t=1092
> heading "Branches outside branches/".
>
> You may need something like
>     git config --add svn-remote.svn.fetch
> "path.../branchX:refs/remotes/branchX"
> for each of your branches.

Thanks,

that works :)

Although not an ideal solution - I have to manually configure all
branches + update them as they are created


--
Piotr Krukowiecki

```

## Stephen Bash, 2012-12-05 16:44

Subject: Re: git-svn with non-standard repository layout
Message-ID: <1056577717.281976.1354725880396.JavaMail.root@genarts.com>
URL: https://gitlist.dev/e/1056577717.281976.1354725880396.JavaMail.root%40genarts.com
In-Reply-To: <CAA01Csoam7pXqPKnjvJB46T_sdjcW2S1oXdQT3HbUdfN4TK0kw@mail.gmail.com>

```
----- Original Message -----
> From: "Piotr Krukowiecki" <piotr.krukowiecki@gmail.com>
> Sent: Wednesday, December 5, 2012 11:26:54 AM
> Subject: Re: git-svn with non-standard repository layout
> 
> On Tue, Dec 4, 2012 at 10:19 PM, Carsten Fuchs
> <carsten.fuchs@cafu.de> wrote:
> > Hi Piotr,
> >
> > Am 2012-12-04 18:29, schrieb Piotr Krukowiecki:
> >
> >> Is there a way to handle svn repository with following layout?
> >>
> >> repo/trunk
> >> repo/branches/branch1
> >> repo/branches/branch2
> >> repo/branches/work/developer1/branch3
> >> repo/branches/work/developer1/branch4
> >> repo/branches/work/developer2/branch5
> >
> > see my post at
> >     http://www.cafu.de/forum/viewtopic.php?f=14&t=1092
> > heading "Branches outside branches/".
> >
> > You may need something like
> >     git config --add svn-remote.svn.fetch
> > "path.../branchX:refs/remotes/branchX"
> > for each of your branches.
> 
> that works :)
> 
> Although not an ideal solution - I have to manually configure all
> branches + update them as they are created

It's not a 100% solution, but you can use a limited glob-like syntax in the branches and tags lines of the svn-remote config block.  You still need to do some manual work (one entry for each developer), but the wildcards eliminate a lot of the grunt work as individual branches are created.  See the very end of the git-svn manpage for examples (section titled CONFIGURATION).  I use that technique to track a subdirectory of the Slimdevices SVN repo [1], which has a similarly complex layout:

repo/7.1/trunk
repo/7.1/branches/branchA
repo/7.1/branches/branchB
repo/7.1/tags/tag1
repo/7.2/trunk
repo/7.2/branches/branchC
...

HTH,
Stephen

```

## Piotr Krukowiecki, 2012-12-05 22:19

Subject: Re: git-svn with non-standard repository layout
Message-ID: <CAA01CsoS6xA-tGPw81tYmi1ETU8sQ08+oyHGg5ou1VGYrwd_SQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAA01CsoS6xA-tGPw81tYmi1ETU8sQ08%2BoyHGg5ou1VGYrwd_SQ%40mail.gmail.com
In-Reply-To: <1056577717.281976.1354725880396.JavaMail.root@genarts.com>

```
On Wed, Dec 5, 2012 at 5:44 PM, Stephen Bash <bash@genarts.com> wrote:
> ----- Original Message -----
>> From: "Piotr Krukowiecki" <piotr.krukowiecki@gmail.com>
>> Sent: Wednesday, December 5, 2012 11:26:54 AM
>> Subject: Re: git-svn with non-standard repository layout
>>
>> On Tue, Dec 4, 2012 at 10:19 PM, Carsten Fuchs
>> <carsten.fuchs@cafu.de> wrote:
>> > Hi Piotr,
>> >
>> > Am 2012-12-04 18:29, schrieb Piotr Krukowiecki:
>> >
>> >> Is there a way to handle svn repository with following layout?
>> >>
>> >> repo/trunk
>> >> repo/branches/branch1
>> >> repo/branches/branch2
>> >> repo/branches/work/developer1/branch3
>> >> repo/branches/work/developer1/branch4
>> >> repo/branches/work/developer2/branch5
>> >
>> > see my post at
>> >     http://www.cafu.de/forum/viewtopic.php?f=14&t=1092
>> > heading "Branches outside branches/".
>> >
>> > You may need something like
>> >     git config --add svn-remote.svn.fetch
>> > "path.../branchX:refs/remotes/branchX"
>> > for each of your branches.
>>
>> that works :)
>>
>> Although not an ideal solution - I have to manually configure all
>> branches + update them as they are created
>
> It's not a 100% solution, but you can use a limited glob-like syntax in the branches and tags lines of the svn-remote config block.  You still need to do some manual work (one entry for each developer), but the wildcards eliminate a lot of the grunt work as individual branches are created.  See the very end of the git-svn manpage for examples (section titled CONFIGURATION).  I use that technique to track a subdirectory of the Slimdevices SVN repo [1], which has a similarly complex layout:
>
> repo/7.1/trunk
> repo/7.1/branches/branchA
> repo/7.1/branches/branchB
> repo/7.1/tags/tag1
> repo/7.2/trunk
> repo/7.2/branches/branchC

Do you mean something like

   branches = branches/work/*/*:refs/remotes/work/*
   branches = branches/{branch1,branch2}:refs/remotes/branches/*

instead of (currently used)

   branches = branches/work/*/*:refs/remotes/work/*
   fetch = branches/branch1:refs/remotes/branches/branch1
   fetch = branches/branch2:refs/remotes/branches/branch2

I will try that tomorrow.

BTW what's the difference between "fetch" and "branches" keys? I could
only find one: "fetch" does not support glob arguments and "branches"
do.

--
Piotr Krukowiecki

```

## Stephen Bash, 2012-12-05 23:54

Subject: Re: git-svn with non-standard repository layout
Message-ID: <516524996.289805.1354751683987.JavaMail.root@genarts.com>
URL: https://gitlist.dev/e/516524996.289805.1354751683987.JavaMail.root%40genarts.com
In-Reply-To: <CAA01CsoS6xA-tGPw81tYmi1ETU8sQ08+oyHGg5ou1VGYrwd_SQ@mail.gmail.com>

```
----- Original Message -----
> From: "Piotr Krukowiecki" <piotr.krukowiecki@gmail.com>
> Sent: Wednesday, December 5, 2012 5:19:44 PM
> Subject: Re: git-svn with non-standard repository layout
> 
> Do you mean something like
> 
>    branches = branches/work/*/*:refs/remotes/work/*
>    branches = branches/{branch1,branch2}:refs/remotes/branches/*
> 
> instead of (currently used)
> 
>    branches = branches/work/*/*:refs/remotes/work/*
>    fetch = branches/branch1:refs/remotes/branches/branch1
>    fetch = branches/branch2:refs/remotes/branches/branch2

Essentially yes.  But I guess since you have branches at the same level as the work directory, you either have to add to the glob for each new branch or add another fetch line...  Doesn't seem like a big win to me.  Jumping on a tangent, I thought there could only be one wildcard on the left side of the ':' (and the '*' on the right).  If your work/*/* is actually working, that's quite interesting.
 
> BTW what's the difference between "fetch" and "branches" keys? I could
> only find one: "fetch" does not support glob arguments and "branches"
> do.

That's the only difference I've discovered, though someone more familiar with the code might be able to say more.

Here's my config for the Slimdevices repo I mentioned:

[svn-remote "svn"]
	url = http://svn.slimdevices.com/repos/slim

	fetch = trunk/server:refs/remotes/trunk
	fetch = 7.5/trunk/server:refs/remotes/7.5/trunk
	fetch = 7.6/trunk/server:refs/remotes/7.6/trunk
	fetch = 7.7/trunk/server:refs/remotes/7.7/trunk
	fetch = 7.8/trunk/server:refs/remotes/7.8/trunk

	branches = branches/*/server:refs/remotes/pre7/*
	branches = 7.5/branches/*/server:refs/remotes/7.5/*
	branches = 7.6/branches/*/server:refs/remotes/7.6/*
	branches = 7.7/branches/*/server:refs/remotes/7.7/*
	branches = 7.8/branches/*/server:refs/remotes/7.8/*

	tags = 7.5/tags/*/server:refs/remotes/7.5/tags/*
	tags = 7.6/tags/*/server:refs/remotes/7.6/tags/*
	tags = 7.7/tags/*/server:refs/remotes/7.7/tags/*
	tags = 7.8/tags/*/server:refs/remotes/7.8/tags/*

Lots of repetition, but now that I look at it this repo doesn't have the branches/work clash yours does, which simplifies the config.

HTH,
Stephen

```

## Piotr Krukowiecki, 2012-12-11 15:46

Subject: Re: git-svn with non-standard repository layout
Message-ID: <CAA01CsqJPw9gNfgg5m6YycAsUct1AR=0v=OBj0hAMqLf6ZaKOw@mail.gmail.com>
URL: https://gitlist.dev/e/CAA01CsqJPw9gNfgg5m6YycAsUct1AR%3D0v%3DOBj0hAMqLf6ZaKOw%40mail.gmail.com
In-Reply-To: <516524996.289805.1354751683987.JavaMail.root@genarts.com>

```
On Thu, Dec 6, 2012 at 12:54 AM, Stephen Bash <bash@genarts.com> wrote:
> ----- Original Message -----
>> From: "Piotr Krukowiecki" <piotr.krukowiecki@gmail.com>
>> Sent: Wednesday, December 5, 2012 5:19:44 PM
>> Subject: Re: git-svn with non-standard repository layout
>>
>> Do you mean something like
>>
>>    branches = branches/work/*/*:refs/remotes/work/*
>>    branches = branches/{branch1,branch2}:refs/remotes/branches/*
>>
>> instead of (currently used)
>>
>>    branches = branches/work/*/*:refs/remotes/work/*
>>    fetch = branches/branch1:refs/remotes/branches/branch1
>>    fetch = branches/branch2:refs/remotes/branches/branch2
>
> Essentially yes.  But I guess since you have branches at the same level as the work directory,
> you either have to add to the glob for each new branch or add another fetch line...  Doesn't seem
> like a big win to me.  Jumping on a tangent, I thought there could only be one wildcard on the
> left side of the ':' (and the '*' on the right).  If your work/*/* is actually working, that's quite interesting.

At first I though it was working, but it seems it does not. I have
several branches, including:
  remotes/trunk
  remotes/work/user/xxx (based on remotes/trunk)
  master (based on remotes/trunk)
  xxx (based on remotes/work/user/xxx)

If I do 'git svn rebase -l' on xxx, it rebases commits on xxx (i.e.
remotes/trunk..remotes/work/user/xxx)
on top of master, so now xxx is based on master  :(

I don't know if this is git-svn bug, or the problem with 'work/*/*'
pattern, or something else...
I will try explicit branches specification and will see what happens.


--
Piotr Krukowiecki

```
