Easily juggle all your checkouts: checkoutmanager

Tags: python, django

(Update: it works on windows, too, now: 1.1 is out)

All my life is stored in version control, basically. Several django applications, several websites, some personal stuff, my PhD thesis: everything is in subversion/mercurial/bzr/git. I just counted them: I’ve got 86 checkouts at the moment :-)

Doing an “svn up” or “hg pull -u” in all of them is boring. And re-building the whole set of checkouts on a fresh machine is hell. And I knew I was about to be changing jobs at the end of 2009. Which meant a change of laptop. Which meant I wrote a small program to manage my checkouts: checkoutmanager. A simple easy_install checkoutmanager is enough to install it.

The basis is a ~/.checkoutmanager.cfg configuration file:

# Sample config file.  Different sections per base location
# and version control system.  Splitting everything all over
# the place in multiple directories is fine.

[recipes]
# Buildout recipes I work on.
vcs = svn
basedir = ~/svn/recipes
checkouts =
    svn://svn/blablabla/trunk
    svn://svn/another/trunk differentname
    http://host/yetanother/trunk
    https://host/yetanother/branches/reinout-fix

[dotfolders]
# Folders that end up as dotted configfolders in the root.
# Note that there's a directory name behind the repository
# location, separated by a space.
vcs = bzr
basedir = ~
checkouts =
    lp:emacsconfig/trunk .emacs.d
    sftp://somwhere/subversion/trunk .subversion

So you’ve got a couple of sections. Every section has a base directory where everything is placed. And a version control system: so one vcs per directory. And a couple of repository locations.

What I normally do every morning when I get to work is checkoutmanager up. This grabs the latest versions of all my checkouts from the server(s). So an svn up for my subversion checkouts, a hg pull -u for mercurial and so on.

From time to time, I’ll do a checkoutmanager st to show if I’ve got some uncommitted files lying around somewhere. Very handy if you’ve worked in several directories throughout the day: it prevents you from forgetting to check in that one bugfix for a whole week.

A new project means I add a single line to my config file and run checkoutmanager co.

Checkoutmanager allows you to spread your checkouts over multiple directories. It cannot mix version control systems per directory, however. As an example, I’ve got a ~/buildout/ directory with my big svn website projects checked out there. And a directory with my svn work python libraries. And a ~/hg/ dir with my mercurial projects. And I’ve made checkouts of several config directories in my home dir, such as ~/.emacs.d, ~/.subversion and so on. Works just fine.

I’m real happy with checkoutmanager. It is simple and it works. What more can you ask for? So I invite you to try it. Just run “checkoutmanager” and you’ll get a full explanation and even a sample config file.

 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):