I followed someone's advice to pipe svn-fe's output into fossil's git
importer, and the result is just awful.  I blame svn-fe for not handling
the "standard" svn repository layout properly.  What I have are svn dump
files, and lots of them.  The steps I've found that will import all
branches and tags properly require git-svn, and are as follows:

# If you have a dump file...
svnadmin create svn_myrepos
svnadmin load svn_myrepos < myrepos.dmp

# Now that you have a repository directory...
mkdir git_myrepos
cd git_myrepos
git svn init -s file:///home/myuser/svn_myrepos
git svn fetch

# at this point, it's the standard import
git fast-export --all | fossil import --git myrepos.fossil

I've attached a script to do this in batch, along with setting a standard
password on all of the imported repositories (I needed it).

mightyhe
#!/usr/bin/python
import os
import re
import getpass

def main():
    """***Warning*** - This script works on Unix only
       ***Warning*** - This script requires git-svn to work, try "yum install svn-git"

       For those of us who read the subversion manual, and did a standard layout, we
       find that "svn-fe path_to_repository | fossil import --git repos.fossil" just
       isn't good enough, because svn-fe doesn't properly handle branches and tags.
       To handle things properly, we need to use "git-svn -s" somewhwere along the
       data transfer path.

       This script will take a directory of subversion dmp files with standard layout
       (trunk, root, tags) and turn them into fossil repositories if you don't have a
       dmp file, you can either "svnadmin dump /path_to_repos > repos.dmp or alter
       the script to use repository paths directly (jump to git svn init)"""

    cwd = os.getcwd()
    defuser = getpass.getuser()
    defpasswd = getpass.getpass('Default Fossil Password: ')

    for fname in os.listdir('.'):
        mo = re.match(r'(.+)\.dmp', fname)
        if not mo:
            continue
        print "processing "+os.path.join(cwd,fname)+"..."
        base = mo.group(1)
        dmpfile = os.path.join(cwd, fname)
        svndir = os.path.join(cwd,'svn_'+base)
        gitdir = os.path.join(cwd,'git_'+base)
        fossilfile = os.path.join(cwd,base+'.fossil')
        os.system('svnadmin create '+svndir)
        os.system('svnadmin load '+svndir+' < '+dmpfile)
        os.mkdir(gitdir)
        os.chdir(gitdir)
        os.system('git svn init -s file://'+svndir)
        os.system('git svn fetch')
        os.system('git fast-export --all | fossil import --git '+fossilfile)
        os.chdir(cwd)
        os.system('rm -Rf '+gitdir)
        os.system('rm -Rf '+svndir)
        os.system('fossil user --repository '+fossilfile+' password '+defuser+' '+defpasswd)

main()
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to