Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-enable mirroring with git-svn

For some time now I've been mirroring a Subversion repository to a Git repository. Which has always worked fine. However, due to a crash of a virtual server and not having a backup I've got to setup the mirror again. The repository I need to track is almost 1200 commits big and contains a lot of files (which is the main reason for the Git mirror, as it's so much faster to checkout a copy of the repo).

What I need to do now is make my freshly cloned Git mirror make track the Subversion repository again. I've got no problems adding the new remote ref but can't seem to figure out how to be able to pull svn commits into the Git branch again.

One error I seem to receive is Unable to determine upstream SVN information from working tree history.

How can I re-enable mirroring a Subversion repository on a existing Git branch that's only behind a couple commits from the Subversion repository?

like image 328
Htbaa Avatar asked Jul 09 '11 19:07

Htbaa


1 Answers

The easiest way to get it to work again is to copy over the .git/svn directory from the original, as this is where extra svn metadata are tracked (assuming the git-svn config is the same).

However, since you don't have it try this:

  1. git svn init http://hostname/svn/repository with any other parameters you used before (maybe -s?)

  2. git checkout the latest commit from svn.

  3. Recreate the git-svn ref: git update-ref refs/remotes/git-svn HEAD (or if you used -s, this should be refs/remotes/trunk instead)

  4. Fetch the latest from svn since the current commit: git svn fetch --parent. This should rebuild git-svn metadata for your entire history.

like image 83
dahlbyk Avatar answered Oct 15 '22 05:10

dahlbyk