Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our development team is currently using SVN to manage our web application development. The developer managing the SVN server is trying to migrate it from an older Win XP server to another server, but trying to output a dump of the repository fails (corruption or something). Why it is failing is a separate question altogether.

The dev managing the SVN repo suggested exporting the current HEAD of the old repo to use as the base of the new SVN repo, but we will lose all our SVN history. I use git-svn locally which means I have 1.5 years of commit information stored locally. Is there a way to get these commits out of git-svn and put them in a new SVN repo?

share|improve this question
Push the commits into a new Git repository instead. :D – grawity Aug 2 '11 at 20:19

If you create a new, empty SVN repo, can you push all the commits from git-svn directly into the repo? (haven't used git or git-svn, but this is what I'd do with one of my hg repos if I needed to get it into an svn repo)

Edit: I managed to get this to work with manual rebasing via mercurial. The only thing that seems special is the manual rebase instead of the automatic svn rebase. You might try that in git-svn before pulling mercurial into the mix.

  1. Create new SVN Repo: svnadmin create targetSVN
  2. Do initial commit on new SVN repo:

    svn co file://targetSVN svnCopy cd svnCopy
    touch test
    svn add test; svn commit -m "Initial Import"

  3. Check the repo out via hg: hg clone file://targetSVN hgCopy; cd hgCopy
  4. Pull in changes from git (via hg-git): hg pull git://yourrepo.git
  5. Manual rebase: hg rebase -s tip -d 0 (0 should be the inital SVN commit, and tip should be the head of the stuff you pulled from git. Make sure the git changesets are linear (have no merges!). Substitute tip for the actual changeset number of the git head (found via hg heads) if necessary). Accept all remote changes when it asks about conflicts.
  6. hg push until all changes are in the svn repo. It pushes 1 changeset at a time.

share|improve this answer
git-svn doesn't seem to handle multiple remote svn repos that well; it doesn't want to dcommit my changes to my second svn-remote repo. I don't know if it is properly rebasing all the commits onto the new repo's base commit... – James Aug 2 '11 at 20:48
What happens if you create a new repo, check it out with git-svn, pull in changes from the first git-svn repo, rebase, and then push? – Darth Android Aug 2 '11 at 20:53
After rebasing the master branch from the first git-svn repo onto the second git-svn repo's mater branch, git svn dcommit fails with "Unable to determine upstream SVN information from HEAD history. Perhaps the repository is empty. at /usr/lib/git-core/git-svn line 522." git svn info also stopped working with the same error. – James Aug 2 '11 at 21:02
Try doing an initial commit in the svn repo and pulling that first. Just touch a file, commit it, and delete it after you get the data imported. – Darth Android Aug 2 '11 at 22:28
No luck, I was still unable to dcommit the rebased commits from the original git-svn. – James Aug 4 '11 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .