eazysvn makes subversion saner
May 29, 2008
When you work with subversion a lot, the first thing you’ll notice is that you have to type the repository URL a lot (when switching, merging, tagging, etc.). This can, of course, be avoided by defining an environment variable. For instance, my
.profile contains the following line:
$ export z=svn+ssh://firstname.lastname@example.org/repos/main
That way I can easily check out any Zope project with
$ svn co $z/PROJ/trunk PROJ
That saves a lot of typing already (and frankly, any Zope developer who doesn’t have an environment variable like this is… well, it’s their own damn fault anyway) . But other operations, especially merging, are still a p.i.t.a. because you have to find out the revision number that created the branch and then type it all in. You also have to remember what your branch was called.
Let’s say I’m experimenting with something in, say, Grok. So I’m messing within a Grok trunk checkout and now I want to check it in. But since it’s some goofy experiment, it can’t go into the trunk. So I must now create a branch, switch my working copy to that and only then I can check things in. With eazysvn, it’s really simple:
$ ezswitch -c philikon-goofy-experiment $ svn ci
As you might’ve guessed
ezswitch switches a working copy to an already existing branch. But if that branch doesn’t exist yet, I can tell it to create the branch using the
So now I can happily check things into my experimental branch from that working. Quite a few weeks later I might remember that I had a branch like this. But what was the name of that branch?
ezmerge can tell me:
$ ezmerge -l 0.10 0.11 0.12 neanderthal-startupspeed philikon-goofy-experiments snowsprint-viewlets2
Great. So let’s say I’m now in a trunk checkout of Grok and I’d like to merge the
philikon-goofy-experiments branch. Normally, I’d have to figure out the revision numbers and the URL. Not with
$ ezmerge philikon-goofy-experiments
This will figure out all the revision numbers automatically. It will even, before merging, produce a log output of the branch so you get an idea what you did on it and can compose the check-in message for the merger from it.
ezmerge is also useful in another situation, namely when merging bugfixes to release branches. Let’s say I fixed a bug on the Grok 0.12 maintenance branch in r12345 and the fix now needs to be propagated to the trunk. No problem:
$ ezmerge 12345 0.12
(assuming that the Grok 0.12 maintenance branch is called
0.12). This will figure out all this revision number arithmetic that svn normally needs you to do. What a time saver!
Update: I should note that eazysvn isn’t specific to Zope’s subversion repository (even though the z in the name may suggest this). ezmerge and ezswitch in fact work with any repository that adheres to the common trunk/branches/tags convention and it simply inspects the path of the working copy to figure out the paths of branches that you want to merge or switch to.