git-svn-replay - replay git commits into a throwaway svn repo
git-svn-replay [options] [git.repo] [checked_out.svn] or -S svn.repo [checked_out.svn] or -s dirname [checked_out.svn] -q: quiet operations -b: branch to pull (default: master) -d: database (default: ./replay.rdb) -l: stdout logfile (default: /dev/null) -f: .msg format -S: create an svn repo and check it out -s: directory to add to the svn repo (can be specified more than once) -h: help
git.repo: The source repo will be untouched, can be remote or local, all git urls will work just fine (default ./g.repo).
checked_out.svn: This will issue svn commands to the checked_out.svn (and the corresponding repo) (default: ./s.co). It is assumed this is a throwaway repo used for nothing besides interacting with trac.
This tool simply replays a git repo into an svn repo for the purpose of using svn natively in Trac. It has the side effect of helping to import more than one project into Trac -- something it did not yet support at the time of this writing.
The svn repo that this tool creates and uses is assumed to be a throwaway and is not meant for people to pull from or push to. It will most likely get dropped and recreated from scratch more than once (from bugs in this app or other problems). This means that the revision numbers will be almost useless and patches may not align quite right.
This tool is really only useful for viewing commits in Trac. It probably has no other purpose.
- -b branchname
The name of the branch to pull (defaults to master).
- -d dbname
The location of the database file (defaults to: ./replay.rdb).
- -l logfilename
Git and SVN make a lot of racket. By default the racket is ignored, but you may choose to dump the racket to a file if you wish.
- -f formatstring
The git pretty=format: argument describing the .msg used in svn. By default, it's:
%s [%h]%n%n%b%n%aN <%aE>%n%ai%n%H
... which looks like this:
git commit subject git commit message body git commit message body git commit message body Paul Miller <email@example.com> ddc7db5df1261cfef79b8bfce524a7b7452ac95d.
- -S svnreponame
Create an svn repo and check it out. It is harmless to specify this if the repo already exists -- it will simply skip the creation.
When -S is specified, no replays will be performed and the first non-switch argument is assumed to be the checked out location, not a git repo. You may specify -s switches along with -S. The repo will not be (re)created if it is already there.
- -s subdirname
Add a subdirectory to the checked out svn.
When -s is specified, no replays will be performed and the first non-switch argument is assumed to be the checked out location, not a git repo. You may specify more than one -s. The directory will not be (re)added if it is already there.
Create an svn repo, check it out, and add a few subdirs to it:
git svn-replay -S s.repo -s blarg1 -s blarg2 -s blarg3 s.co
Add another dir later:
git svn-replay -s blarg4 s.co
Create an svn repo, check it out, and pull the public branch of repo.git into it:
git svn-replay -S s.repo s.co git svn-replay -b public repo.git s.co # repeat this every day or hour
Create an svn repo, check it out, create a dir for proj1, another for proj2 ...:
git svn-replay -S s.repo -s proj1 -s proj2 s.co git svn-replay -b public proj1-repo.git s.co/proj1 # do this from cron git svn-replay -b maint proj2-repo.git s.co/proj2 # do this from cron
It's maybe 100% certain that there's bugs in this strange thing.
Please make backups of all your svn and git repositories before you try to use this for anything. Also, please do not blame me if it ruins your repos. I warned you to make backups.
Do not attempt to use the generated svn repo as a code repository.
You can report bugs either via rt.cpan.org or via the issue tracking system on github. I'm likely to notice either fairly quickly.
Copyright 2009 Paul Miller -- released under the GPL