All Since I have just had to figure out how to do this for jena-csv I figured I would share this with everyone for as and when we need to move more code over from SVN in the future.
= Step 1 - Clone the old repo Firstly we need to do a git svn clone of the old code: > git svn clone http://svn.apache.org/repos/asf/jena/Experimental/jena-csv >jena-csv-conversion --authors-file authors.txt Where authors.txt is a file that maps SVN committer IDs to Git style committer IDs e.g. andy = Andy Seaborne <[email protected]> rvesse = Rob Vesse <[email protected]> etc. This file is essential as otherwise the converted history won't attribute users properly. Check the history and make sure that all the authors look sane, if you see any authors of the form id <id@324234-df453df-dsersdf> then you are missing an author from your authors file and should re-run the process. I can check in/post the authors file I used for converting jena-csv somewhere as an example/base for others to use in future if that would be helpful. Don't worry if you see the following warning: W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: '/repos/asf/!svn/rvr/100/jena/Experimental/jena-csv' path not found W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. Just ignore this and leave the git svn clone running. Since the Apache SVN repository is big this will take a long time so you should probably go get a coffee or do some other work for a bit. = Step 2 - Move the code within the converted repo to the appropriate directory You will now have a git repo that has the portion of code you are converting however this will likely all be in the top level directory and you want it to be in a specific sub-directory when you merge it into the main repo. So we can use git mv to do this: > mkdir jena-csv > git mv LICENSE NOTICE pom.xml jena-csv > git commit -m "Move code into new location for merging" = Step 3 - Merge the old code in For this I strongly recommend that you first create a fresh clone of our main repository in case you manage to get your clone into a bad state: > git clone --no-hardlinks existing-clone fresh-clone > cd fresh-clone If the code is ready to be merged as is you can skip creating a feature branch but if the code needs some cleaning up first then you probably want to checkout a new branch first: > git checkout -b jena-csv Then you can do the actual merge: > git remote add -f jena-csv-source ../jena-csv-conversion > git pull jena-csv-source master Git will prompt you to do a merge commit and you should edit the commit message appropriately You should now see a jena-csv directory as a sub-directory of your current directory. Check that the history has been maintained by going into that directory and doing a git log --follow on a file e.g. > cd jena-csv > git log --follow jena-csv The --follow is necessary because in Step 2 we moved the code to its new location = Step 4 - Push the new branch If you've merged to master you can now push the changes if you are happy with them, remember that since you created a fresh clone the initial push only pushed to your original clone (unless you've manually changed the remote) and so you will also need to push from the original clone to actually push the changes up to Apache. If you created a new local branch then you need to push it to the remote if you want it to become visible: > git push -u origin jena-csv Note that since we created a fresh clone (you did right?) then we then need to switch to our existing code and repeat this step to actual push it out to the Apache remote: > cd ../existing-clone > git push -u origin jena-csv --- Rob
