I officially presented on django at SUNY Albanys 3rd Annual Open Source Festival. (Ignore the lame joke about the movie, and keep in mind this was my first time public speaking)
At work we’ve made the switch to git, however we’ve been using SVN up to this point so I’m trying to get a consistent process for it. This is where git-svn shines, the integration is great – and it lets me embrace magit (an emacs mode for git).
git svn clone --stdlayout some-svn-url
This gives me 90% of the functionality I need – except for one thing, svn externals. They can be a pain, but we’ve used them for a number of projects in the past, and it would be great if I could handle them seamlessly within git-svn.
Scouring stackoverflow resulted in this post which suggests using a git-svn-clone-externals script to copy each one of your SVN externals (using git-svn clone) to a separate directory which you ignore. Then symlinks the expected areas of your original codebase to the separate directory. Presto?
From here, you can go to each git directory and perform the standard
git svn fetch and
git svn rebase – and keep your SVN externals up to date.
However, it’s no fun unless you’re using magit. Magit’s SVN integration is minimal (~300 lines of code) – but it gets the job done, almost.
This code simply adds an extra option “x” to the magit-svn prompt that fetches and rebases each SVN external as a git-svn repository.
Overall, magit-svn-mode has proven to be really great, with one caveat – when you
M-x magit-status in a git-svn directory it doesn’t automatically enter magit-svn-mode which can be frustrating, this code checks if your current repository is of the git-svn variety, and enables magit-svn-mode automatically if so: