Skip to contentSkip to conversation

git svn with non-standard svn layout

DISCUSSION Fabian Molder 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

- want to use git inside an huge SVN project
--> so git-svn could do the job ..

- I struggle with two things:
A) - the SVN project has an non-standard layout
B) - want to have (several) git's for just the (few) peaces I work on

for A)
======
- svn layout looks like this (simplified):
- trunk (not really used, all interesting work in branches)
- branches
- r1.2
- development
- integration
- r1.3
- development
- integration
...

- inside development and integration is:
- xapplication1
- xapplication2
- xapplication3
...
- aa
-bb
-cc
- zapplication1
- zapplication2
- zapplication3
...

- I created an simplified svn test (from scratch; import/repo/workdir)
via this bash-script: http://pastebin.ca/1608231

for B)
======
- the svn repo is very huge, but I'm only interested in these dirs:
xapplication2/
aa/bb/cc/zapplication1
- my objectives:
- have several local git's, just the ones I need:

     --> xapplication2/.git
     --> aa/bb/cc/zapplication1/.git

I tried to use "git config svn-remote.svn.branches" to do this,
please see in function "do_git_svn" in bash-script - but no success

any hints appreciated

regards,
Fabian

#1 lore raw
Quoted 45 lines · Fabian Molder

Hello,

- want to use git inside an huge SVN project
--> so git-svn could do the job ..

- I struggle with two things:
A) - the SVN project has an non-standard layout
B) - want to have (several) git's for just the (few) peaces I work on

for A)
======
- svn layout looks like this (simplified):
- trunk (not really used, all interesting work in branches)
- branches
- r1.2
- development
- integration
- r1.3
- development
- integration
...

- inside development and integration is:
- xapplication1
- xapplication2
- xapplication3
...
- aa
-bb
-cc
- zapplication1
- zapplication2
- zapplication3
...

- I created an simplified svn test (from scratch; import/repo/workdir)
via this bash-script: http://pastebin.ca/1608231

for B)
======
- the svn repo is very huge, but I'm only interested in these dirs:
xapplication2/
aa/bb/cc/zapplication1
- my objectives:

Quoted 3 lines
   - have several local git's, just the ones I need:
     --> xapplication2/.git
     --> aa/bb/cc/zapplication1/.git

Hi Fabian,

Since you don't want to track the entire repo and these seem like unrelated (history-wise) trees, you probably want the simplest cases:

git svn clone svn://example.com/path/to/xapplication2 git svn clone svn://example.com/path/to/aa/bb/cc/xapplication1

These commands are like doing the following with plain old svn:

svn co svn://example.com/path/to/xapplication2 svn co svn://example.com/path/to/aa/bb/cc/xapplication1

Quoted 2 lines

I tried to use "git config svn-remote.svn.branches" to do this,
please see in function "do_git_svn" in bash-script - but no success

svn-remote.svn.branches and tags are really only for repos with standard layouts.

Signature · 1 line
Eric Wong
#2 lore raw

Eric Wong <normalperson <at> yhbt.net> writes:

...

Quoted 11 lines

Hi Fabian,

Since you don't want to track the entire repo and these seem like unrelated (history-wise) trees, you probably want the simplest cases:

git svn clone svn://example.com/path/to/xapplication2 git svn clone svn://example.com/path/to/aa/bb/cc/xapplication1

These commands are like doing the following with plain old svn:

Quoted 9 lines

svn co svn://example.com/path/to/xapplication2 svn co svn://example.com/path/to/aa/bb/cc/xapplication1

Quoted 2 lines

I tried to use "git config svn-remote.svn.branches" to do this,
please see in function "do_git_svn" in bash-script - but no success

svn-remote.svn.branches and tags are really only for repos with standard layouts.

Hello Eric,
hmm, understand,
but this just does an checkout to the working dir

the reason for using git is:
- work offline, with (at least read) access to all the svn branches
- have some more (privat, not commit back to svn) branches for experiments
- all the nice git stuff ..
regards,
Fabian

#3 lore raw
Quoted 21 lines · Fabian Molder
Quoted 10 lines · Eric Wong <normalperson <at> yhbt.net> writes:

Hi Fabian,

Since you don't want to track the entire repo and these seem like unrelated (history-wise) trees, you probably want the simplest cases:

git svn clone svn://example.com/path/to/xapplication2 git svn clone svn://example.com/path/to/aa/bb/cc/xapplication1

These commands are like doing the following with plain old svn:

Quoted 9 lines

svn co svn://example.com/path/to/xapplication2 svn co svn://example.com/path/to/aa/bb/cc/xapplication1

Quoted 2 lines

I tried to use "git config svn-remote.svn.branches" to do this,
please see in function "do_git_svn" in bash-script - but no success

svn-remote.svn.branches and tags are really only for repos with standard layouts.

Quoted 8 lines

Hello Eric,
hmm, understand,
but this just does an checkout to the working dir

the reason for using git is:
- work offline, with (at least read) access to all the svn branches
- have some more (privat, not commit back to svn) branches for experiments
- all the nice git stuff ..

Sorry, not sure if I understood you the first time. The pastie was hard to read on my screen (big fonts, low res).

I think what you need is to match the number of globs (*) on both the remote and local sides:

  REMOTE=branches/*/*/aa/bb/cc/zapplication1
  LOCAL=refs/remotes/svn/aa/bb/cc/zapplication1/*/*
  git config svn-remote.svn.branches "${REMOTE}:${LOCAL}"

#---> matches all in svn repo and also creates subdirs
#
# git config svn-remote.svn.branches \
# "branches/r*/development/aa/bb/cc/zapplication1:refs/remotes/svn/branches/*"
#
#--> Missing trailing '/' on left side of: 'branches/r*/development/aa/bb/cc/zapplication1' (branches/r)

The glob code is still a bit wonky, but it needs to be "/*/" (that is "*" must have a "/" or nothing, but not "/r*/"

But it looks like the example with 2 globs works.

Signature · 1 line
Eric Wong