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://philikon@svn.zope.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.

Now enter eazysvn. It’s a set of tools that I wrote (back then it was just ezmerge.py) which were refined later by Marius Gedminas and myself. Here’s how it works:

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 -c parameter.

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:

$ 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 called0.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.

2 Responses to “eazysvn makes subversion saner”


  1. There is also a command line tool called SV. It is a wrapper around subversion to simplify the task of branching and merging:

    http://code.google.com/p/sv-subversion/wiki/CommandReference

  2. philikon Says:

    Nice! I didn’t know about this one. Thanks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: