As title, is there any way to reconstruct a svn repo from a full clone with git-svn (containing every single commit starting from r1)?
Edit:
I probably shoul
In theory, it is possible to recreate a repository that is very close to the original Subversion repository. However, there are some aspects of Subversion repository data (such as properties and mergeinfo) that is not cloned by git-svn
. Therefore you won't necessarily be able to recreate an exact copy of the original.
Yes, it's possible to create an SVN repository rather close to your git-svn repository (even restoring svn:mergeinfo from Git merge commits and svn:ignore from .gitignore). The steps to do that:
1.Prepare branches and tags:
Create refs/heads/* for every refs/remotes/* (current refs/heads/* positions will be lost):
$ git branch -a | awk '/remotes\/([^\/])+$/{ref=substr($1, 9); system("git update-ref refs/heads/" ref " refs/remotes/" ref )}'
or you can set refs/heads/* for all interesting branches manually
Note that refs/heads/master is mapped to SVN trunk but the script above will set refs/heads/trunk to refs/remotes/trunk. So after running it one should set refs/heads/master to refs/remotes/trunk and delete refs/heads/trunk:
$ git update-ref refs/heads/master refs/remotes/trunk
$ git branch --delete refs/heads/trunk
The same about tags: set refs/tags/* to refs/remotes/tags/* positions:
$ git branch -a | awk '/remotes\/tags\/([^\/])+$/{ref=substr($1, 14); system("git update-ref refs/tags/" ref " refs/remotes/tags/" ref )}'
Check that all refs/remotes/* and refs/remotes/tags/* are converted to refs/heads/* and refs/tags/* because only these references will be converted.
2.Create an empty SVN repository
$ svnadmin path/for/svn/repository
3.Create a bare Git repository containing refs/heads/* and refs/tags/* prepared at step 1:
$ git clone --bare path/to/git-svn/repository path/for/svn/repository/.git
4.Download and install SubGit using this link (intermediate build that removes "git-svn-id:" signatures from Git commits messages while converting). In general, SubGit is not free but for one shot conversion (your case) it can be used for free. Convert the repository with SubGit (it expects to find the Git repository at path/for/svn/repository/.git)
$ subgit install path/for/svn/repository
5.After SubGit installation Git and SVN repositories will be kept in sync. Optionally to break bi-directional synchronization (you can enable it any time), run
$ subgit uninstall path/for/svn/repository