git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Converting SVN repository to git
@ 2005-06-15 18:47 Art Haas
  2005-06-15 22:02 ` Adam Mercer
  2005-06-18  3:26 ` Seth W. Klein
  0 siblings, 2 replies; 3+ messages in thread
From: Art Haas @ 2005-06-15 18:47 UTC (permalink / raw)
  To: git

Hi.

The utilities for converting CVS repositories to git repos have become
part of the standard git package, and hopefully they'll be used to
convert many CVS based projects to git. I've not seen anything, though,
on switching Subversion repositories to git. Has there been any public
activity in writing a tool/script to do this? Perhaps some offline
discussion about doing this?

Thanks in advance.

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Converting SVN repository to git
  2005-06-15 18:47 Converting SVN repository to git Art Haas
@ 2005-06-15 22:02 ` Adam Mercer
  2005-06-18  3:26 ` Seth W. Klein
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Mercer @ 2005-06-15 22:02 UTC (permalink / raw)
  To: git

On 15/06/05, Art Haas <ahaas@airmail.net> wrote:

> The utilities for converting CVS repositories to git repos have become
> part of the standard git package, and hopefully they'll be used to
> convert many CVS based projects to git. I've not seen anything, though,
> on switching Subversion repositories to git. Has there been any public
> activity in writing a tool/script to do this? Perhaps some offline
> discussion about doing this?

You could use something like svn2cvs (http://svn2cvs.tigris.org) and
then use the cvs2git tools.

Cheers

Adam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Converting SVN repository to git
  2005-06-15 18:47 Converting SVN repository to git Art Haas
  2005-06-15 22:02 ` Adam Mercer
@ 2005-06-18  3:26 ` Seth W. Klein
  1 sibling, 0 replies; 3+ messages in thread
From: Seth W. Klein @ 2005-06-18  3:26 UTC (permalink / raw)
  To: Art Haas; +Cc: git

On Wed, Jun 15, 2005 at 01:47:20PM -0500, Art Haas wrote:
> 
> [....] I've not seen anything, though,
> on switching Subversion repositories to git. Has there been any public
> activity in writing a tool/script to do this? Perhaps some offline
> discussion about doing this?

The following script is what I used to convert a simple svn repository.
It doesn't handle branches or tags and contains buggy use of grep and
inscrutable uncommented use of sed but it should be a starting place for
someone with a more complex repository available for testing.

export GIT_AUTHOR_EMAIL=sk@sethwklein.net
export GIT_COMMITTER_EMAIL=sk@sethwklein.net
svn co -r 1 file:///home/sk/rep/oakheart/trunk oakheart
cd oakheart
git-init-db
for REV in `seq 2 692`; do
    echo -n $REV' '
    svn update -r $REV > .svnupdate
    sed -nr 's/^A +//p' .svnupdate \
    | while read F; do [ -f "$F" ] && echo "$F"; done \
    | xargs -r git-update-cache --add --
    sed -nr 's/^D +//p' .svnupdate \ 
    | while read F; do git-ls-files | grep "^$F"'\(/\|$\)'; done \
    | xargs -r git-update-cache --remove --
    sed -nr 's/^U +//p' .svnupdate \
    | while read F; do [ -f "$F" ] && echo "$F"; done \
    | xargs -r git-update-cache --
    PARENT=
    [ -f .git/HEAD ] &&
        PARENT='-p '`cat .git/HEAD`
    svn log -r $REV | sed -n '1,3d;$d;H;/^$/!{s/.*//;x;s/\n//;p}' \
    | git-commit-tree `git-write-tree` $PARENT > .git/HEAD
done

Cheers,
Seth W. Klein
-- 
sk@sethwklein.net     AIM: sethwklein     http://www.sethwklein.net/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-18  3:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-15 18:47 Converting SVN repository to git Art Haas
2005-06-15 22:02 ` Adam Mercer
2005-06-18  3:26 ` Seth W. Klein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).