I wish to fork a project that is currently managed via SVN to Git. The SVN repo is svn.openvpms.org/openvpms Under this are around 8 sub-projects each of which have trunk/branch/tag directories. When I work in my IDE I actually check each out via svn separately but under a specific directory structure eg If this is how SVN shows the projects Openvpms
when I check them out locally I will check out the trunk to
What I would like to do is for fork the whole setup to git, using git-svn but maintain the branchs and tags from SVn for each project.
I could create a Git repo for each project and clone each one which might be my only option, the slight concern I have here is that it would lose the obvious directory structure that exists on the svn repo.
Is there any other way to clone the entire svn repo into a single git repo and maintain the trunk/branch/tags of each subproject?
I recongnize the fact that there is a project management SE site now, but this question really pertains to the usage of git-svn to clone multiple projects each with a tag/branch/trunk structure.
When I issue
git svn clone "svn://svn.openvpms.org/openvpms/openvpms" \
"C:\Users\mydirectory\OPENVPMS-Git LOCAL REPO\openvpms" \
-T trunk -b branches -t tags
what acctually happens straight away is
Initialized empty Git repository in
c:/Users/mydirectory/GIT_LOCAL_REPO/openvpms/.git/
Using higher level of URL:svn://svn.openvpms.org/openvpms/openvpms => svn://svn.openvpms.org/openvpms
So it seems git-svn goes straight back up to the parent anyway...I am just not sure how it will find all the branches and tags.
I am currently trying to use SmartGit's interface to clone the entire repo from the base url svn://svn.openvpms.org/openvpms
...it seems to take days and has locked up twice requiring a restart.
OK well I think I finally sorted this one in the end it comes down to using git svn Firstly I added each svn project as a remote in git by editing the .git/config file. I gave them each a different remote name and alias.
/...
[svn-remote "parent"]
url = svn://example.com/rootproject
fetch = rootproject/trunk:refs/remotes/origin/trunk
branches = rootproject/branches/*:refs/remotes/origin/*
tags = rootproject/tags/*:refs/remotes/origin/tags/*
[svn-remote "subproject1"]
url = svn://localhost/rootproject
fetch = subproject1/trunk:refs/remotes/subproject1/trunk
branches = subproject1/branches/*:refs/remotes/subproject1/*
tags = subproject1/tags/*:refs/remotes/subproject1/tags/*
[svn-remote "subproject2"]
url = svn://localhost/rootproject
fetch = subproject2/trunk:refs/remotes/subproject2/trunk
branches = subproject2/branches/*:refs/remotes/subproject2/*
tags = subproject2/tags/*:refs/remotes/subproject2/tags/*
[svn-remote "subproject3"]
url = svn://localhost/openvpms
fetch = subproject3/trunk:refs/remotes/subproject3/trunk
branches = subproject3/branches/*:refs/remotes/subproject3/*
tags = subproject3/tags/*:refs/remotes/subproject3/tags/*
..../
etc
then I ran
git svn fetch --all
This checked out each project into the root of the git repo Now to restructure I checked out
git checkout origin/trunk
then ran for each sub project
git merge -s ours --no-commit subproject1/master <2>
git read-tree --prefix=subproject1/ -u subproject1/master <3>
git commit -m "Merge subproject1 as our subdirectory" <4>
I now had a project that looked like
ParentProject
|-src
|-parentpom.xml
|-subproject1
| |-src
| |-pom.xml
|-subproject2
| |-src
| |-pom.xml
|-subproject3
| |-src
| |-pom.xml
etc
Now I think I can still run
git fetch --all
then run
git pull -s subtree subproject1 trunk
to update and pull changes from the base svn repos..however given this represents a move to stay with git while keeping all the svn history this should work for me.