# git-svnimport

4 messages from 2006-02-03 to 2006-02-04. Participants: Jason Harrison, Jason Riedy, Martin Langhoff.
Thread: https://gitlist.dev/t/3230

## Jason Harrison, 2006-02-03 19:29

Subject: git-svnimport
Message-ID: <200602031429.07894.jharrison@linuxbs.org>
URL: https://gitlist.dev/e/200602031429.07894.jharrison%40linuxbs.org

```
Greetings,

I am trying to import from an svn repository into a git repository using 
git-svnimport.  So far my attempts have failed.  Here is what I have done so 
far.

git-svnimport svn://svn.debian.org/demi/

### Snippet ###
73: Unrecognized path: /demi.sql
73: Unrecognized path: /lib/dsa.py
74: Unrecognized path: /bin/add-demi-machine
cp: cannot stat `/home/jharrison/svn/demi.git/.git/refs/heads/origin': No such 
file or directory
fatal: master: not a valid SHA1
usage: git-read-tree (<sha> | -m [-u | -i] <sha1> [<sha2> [<sha3>]])
checkout failed: 256

git-svnimport -T demi svn://svn.debian.org/demi/

### Snippet ###
73: Unrecognized path: /web/machine.py
73: Unrecognized path: /lib/demi.py
73: Unrecognized path: /lib/dsa.py
74: Unrecognized path: /bin/add-demi-machine

Thanks for your time.

Regards,
Jason

```

## Jason Riedy, 2006-02-04 02:47

Subject: Re: git-svnimport
Message-ID: <16255.1139021263@lotus.CS.Berkeley.EDU>
URL: https://gitlist.dev/e/16255.1139021263%40lotus.CS.Berkeley.EDU
In-Reply-To: <200602031429.07894.jharrison@linuxbs.org>

```
And Jason Harrison writes:
 - I am trying to import from an svn repository into a git repository using 
 - git-svnimport.  So far my attempts have failed.  Here is what I have done so 
 - far.
 - 
 - git-svnimport svn://svn.debian.org/demi/
[...]
 - git-svnimport -T demi svn://svn.debian.org/demi/
[...]

It seems git-svnimport requires one level of directory 
structure.  Running 
  git-svnimport -T bin svn://svn.debian.org/demi/
gives me the contents of the bin directory while (noisily)
ignoring everything else.  I think svn repositories
usually have a structure with branches in one directory,
tags in another, and its version of HEAD in yet another.

Looking through the git-svnimport source makes it appear
difficult to just snarf just one directory (maybe /) out 
of a svn repository.  Actually, it makes everything svn-
related appear difficult.  Why should I worry about
memory management by default in Perl?!?  It'd be nice if 
there were an git-svnimport-trivial that just snarfed a 
single URL without tags or branches.

I have to deal with a few repos with bizarre directory 
structures but _no_ branches or tags, and I found a work-
around that may be good enough.  Mirroring the repos using
svm (or svn-mirror, from SVN::Mirror) then importing the
mirrors works, but it gives an extraneous first commit.
Example derived from the svn-mirror/svm man page:
  env SVMREPOS=${HOME}/svm svn-mirror init mirror/demi \
        svn://svn.debian.org/demi
  env SVMREPOS=${HOME}/svm svn-mirror sync mirror/demi
  git-svnimport -v -T mirror/demi file://${HOME}/svm

That may spew messages about unrecognized paths if you 
mirror a few repos, but it should work.  Syncing and re-
running git-svnimport appears to keep things up-to-date, 
but I haven't had much opportunity to test that.

SVK (same author as SVN::Mirror) might work for creating
a mirror, possibly without the extraneous first commit, 
but I couldn't figure out the right -T and URL options 
for git-svnimport.

Jason

```

## Martin Langhoff, 2006-02-04 03:12

Subject: Re: git-svnimport
Message-ID: <46a038f90602031912l1d26b615u563e8a9e9d8c625c@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90602031912l1d26b615u563e8a9e9d8c625c%40mail.gmail.com
In-Reply-To: <200602031429.07894.jharrison@linuxbs.org>

```
On 2/4/06, Jason Harrison <jharrison@linuxbs.org> wrote:
> I am trying to import from an svn repository into a git repository using
> git-svnimport.  So far my attempts have failed.  Here is what I have done so
> far.

You always want to be passing the branches and tags parameters
explicitly. SVN repos have so many weird layouts that svnimport does a
bad job without them. Trial and error has worked for me ;-)

See for instance:

  http://www.gelato.unsw.edu.au/archives/git/0512/14069.html

regards,


martin

```

## Martin Langhoff, 2006-02-04 03:16

Subject: Re: git-svnimport
Message-ID: <46a038f90602031916x6cfb9e6bg7dfa0fb1cc237dac@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90602031916x6cfb9e6bg7dfa0fb1cc237dac%40mail.gmail.com
In-Reply-To: <16255.1139021263@lotus.CS.Berkeley.EDU>

```
On 2/4/06, Jason Riedy <ejr@eecs.berkeley.edu> wrote:
> Looking through the git-svnimport source makes it appear
> difficult to just snarf just one directory (maybe /) out
> of a svn repository.  Actually, it makes everything svn-
> related appear difficult.  Why should I worry about
> memory management by default in Perl?!?

I think that the SVN internals are so yucky that we're lucky to get
away with "just" that bit of memory-handling crud.

>  It'd be nice if
> there were an git-svnimport-trivial that just snarfed a
> single URL without tags or branches.

We're definitely needing some updates to the doco for svnimport to
make it easier. Maybe some examples of real life scenarios with
different repo layouts

> I have to deal with a few repos with bizarre directory
> structures...

looks like you're the man for the job ;-)

cheers,


martin

```
