git-svn starting with an empty svn repository
Dear list,
This is maybe an abuse of what git-svn is designed to do, but nevertheless I need to do it.
I'm working with a project (Moodle) that still uses CVS for its upstream VCS. The friendly folk at Catalyst in NZ run a git import of this, that a lot of the community uses as their (read only) upstream instead of CVS.
So far so good.
However, now for various political reasons, I must (at least) publish changes to SVN. I'm going to be patch trading a lot between my work branches, and Moodle's CVS directly and I don't want to lose the power that git gives me while doing that. So I want to keep git as the tool I use for development, that acts as a go-between for me between CVS and SVN.
So what I'd really like to do is something like this:
- clone from Catalyst's git mirror
- push that to SVN using git-svn
- keep working, committing patches to Moodle CVS, and pulling from Catalyst regularly, while pushing both my local changes and new pulled upstream patches, to SVN, using git-svn
The problem seems to be that I'm starting out with an *empty* SVN repository. Almost all of the documentation I've found on this topic is for going from an existing SVN repository to git.
Theoretically at least, the opposite direction should also be possible, but I'm having a hard time figuring it out. I followed the steps outlined in the comments here:
http://quirkygba.blogspot.com/2007/10/using-git-with-google-code-hosting.html
But I didn't have much luck, it seems as though the rebased trunk branch doesn't share any ancestry with the original Catalyst sources, so regularly updating is going to be hard (unless I create graft entries for each time I do it I guess?).
Not to mention the fact that it's 8 years of history that takes a while to import and after about 5 tries I didn't even manage to get git svn to dcommit it and got impatient and cross and stopped trying.
So really I want to know is - is this even possible? Is using the above steps along with the graft approach the best|only way to do it? How brittle is this to maintain, if I even manage to get it imported?
Any ideas or advice?
For reference, the CVS/Git import can be cloned here:
http://git.catalyst.net.nz/git/moodle-r2.git but will take a long time to come down.
Cheers for any help.
Penny
Signature · 4 lines
/* --------------------------------------------------- Penny Leach | http://mjollnir.org | http://she.geek.nz GPG: 8347 00FC B5BF 6CC0 0FC9 AB90 1875 120A A30E C22B --------------------------------------------------- */
Penny,
I've been trying to do the exact same things. I'm using Git to import from CVS and export into a Subversion repository.
What I have done:
- I have used cvsimport for the CVS repository (no problem)
- I have created an empty repository using svnadmin
- I have imported the svn trunk into Git
- I'm cherry-picking any new commits from my cvs-imported branch (master) into the git-svn one (named svn-trunk)
For this last point, I'm using this code sniped:
<<
for i in $(git cherry svn-trunk master | sed -n 's/^+ //p'); do
echo Applying $i;
(git cherry-pick --no-commit $i &&
git log --pretty=format:"Author: %an <%ae>%nDate :
%ad%n%n%s%n%b" -1 $i > /tmp/cm &&
git commit --file=/tmp/cm) || (echo Cannot commit $i; exit 1)
done
Quoted 1 line
Quoted 1 line
I'm editing the log to properly record original author and date.
There is maybe better solutions...
Signature · 8 lines
--|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
Thanks for the reply! I'm glad I'm not the only person crazy enough to attempt this :)
Quoted 4 lines · Pascal Obry
- I have created an empty repository using svnadmin
- I have imported the svn trunk into Git
- I'm cherry-picking any new commits from my cvs-imported branch (master) into the git-svn one (named svn-trunk)
Right - and you used this method to import the original history into the svn-trunk branch, as well as any new patches? Or did you do a once off import of the history using a different method?
Out of interest - how long is the history you're importing? Mine is about 32,000 commits and it takes forever to import into SVN (only to get to a broken point and have to start again...)
Penny
Signature · 4 lines
/* --------------------------------------------------- Penny Leach | http://mjollnir.org | http://she.geek.nz GPG: 8347 00FC B5BF 6CC0 0FC9 AB90 1875 120A A30E C22B --------------------------------------------------- */
Penny,
Quoted 2 lines
Right - and you used this method to import the original history into the svn-trunk branch, as well as any new patches?
Yes.
Quoted 3 lines
Out of interest - how long is the history you're importing? Mine is about 32,000 commits and it takes forever to import into SVN (only to get to a broken point and have to start again...)
The repository is having today 28347 commits exactly, so it is close in size to yours. I have migrated something like 27800 commits initialy, AFAIR it tooks something like 28 hours to complete.
Pascal.
Signature · 8 lines
--|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595