On 12/12/2010 1:10 AM, Jan Dubois wrote: > Please, do tell! :) > > I would like to see all modules broken out into individual git > repositories. I tried this myself a long time ago, but couldn't find a > way to keep the tags, so I didn't go forward with it.
Well, it was really more of an ad-hoc process. Both the svn dump format and the git fast-import format are reasonably well documented and not to hard to parse/generate. I had a script I'd used to extract another project from my personal svn repo, and I adapted it for the purpose. It's not the most elegant code, but it only has to work once. The first problem was that svnadmin only works with direct file access, and I didn't see how to get a dump file from Google Code. A little research led me to svnsync, which can clone a svn repo with only read access to the original. Once I had a local svn repo, I dumped it. Then I created an empty Git repo and initialized it with .gitignore, .gitattributes, & README.md in a back-dated commit (git's --date option and GIT_COMMITTER_DATE environment variable). I went on backpan and got the release dates from the tarball timestamps. Then it was a matter of: 1. Run my script to produce a fast-import file. 2. Copy the empty repo and run git fast-import in the copy. 3. Run gitk and see what happened. 4. Tweak script & repeat until satisfied. For the libwin32 tags, I simply recognized the commit messages. Since they were all "Load libwin32-0.xx into trunk", that was simple. I only had 2 tags made after the svn repo was live, so I punted and just hardcoded the revision numbers that needed tagging. It shouldn't be too hard to get that from the tags/ directory in the dump, but it would have taken me longer, especially since I'd made a habit of recording the revision being tagged in the tag's commit message. (Actually, while writing this, I noticed some of the libwin32 minor releases got skipped, because they didn't change any of the files I was tracking. I could add those tags, but I don't think it's necessary.) If I were going to process the rest of the modules, I'd probably figure out how to get the tags from the svn dump instead of hand marking them. Win32-IPC was one of the most complex extractions, because it had several modules that were originally separate directories, but then became a single directory. This required some munging to get a git repo that looked the way I wanted it without unnecessary renames. My script also reads the Changes files from the individual modules and adds the new changes to the commit messages. That was a bit tricky, because sometimes a module had its version incremented more than once before the next libwin32 release. The process goes like this: svnadmin dump /var/svn/libwin32 >libwin32.dump perl git-from-svndump-libwin32.pl libwin32.dump >libwin32.fi cp -a initialized_repo Win32-IPC cd Win32-IPC git fast-import <../libwin32.fi git repack -a -d -f --window=50 && git gc The repack is needed because fast-import doesn't produce a very efficient repo. I've stuck my script here: https://gist.github.com/738518 The places marked FIXME are libwin32/Win32-IPC specific things that you wouldn't want in a generic svn-to-git script. You'll need a ~/.gitauthors file, which is just a bunch of lines like: svnusername = My Name <m...@email.com> You'll also need to set the $url variable to the path of your local libwin32 repository. I did all this on a Linux box, so there may be issues with CRLF translation if you try it on Windows. -- Chris Madsen p...@cjmweb.net -------------------- http://www.cjmweb.net --------------------