Adventures using Darcs

I've been playing with darcs lately. It's a really cool version control system that has some wicked features, but somehow has managed to get not just the really insane stuff (really complicated patch management and conflict resolution) right, but also managed to get the little details right.

I had a situation yesterday that involved a conversation that went like this:

Friend: I can't find something that will let me give it a bunch of urls in a web browser and let me download all of them!
Me: I have an hour. Lets write it. Give me a PC.
Friend: Okay!

And so it was on. I had a couple hours to churn out a piece of software, and I wanted to do it in such a way as they could use it and I could maintain it. I also knew that any software I wrote in the space of an hour was going to be a steaming pile of crap.

My weapons of choice: Python, Twisted, Darcs, Putty, Vim.

I wrote most of it over SSH to my OSX machine where I had all the tools installed. Before I started, I created a new directory and typed darcs init. This initialised that directory as a darcs repo.

When I got it working for the first time (runnable code that did what was required) I typed darcs record -am "first iteration".

After a few more things I fixed up, I copied it to the windows machine I was doing my work from. I installed Python in C:\Python24, I grabbed the non-cygwin version of darcs and dragged the contents of that to the same directory. I added C:\Python24 to the $Path, and killed two birds with one stone. Now pythom and darcs were both in my path, and I could wreak havoc.

darcs get http://shiny.thorne.id.au/~stephen/Downloader/
cd Downloader
python downloader.py

It worked. I found and fixed bugs using vim on OSX, via putty. Every major change was accompanied by darcs record.

To test the code on win32, I used darcs pull -a to suck down the new patches.

Great. It worked. I wanted to show the person I wrote the code for how to use darcs, just in case he made modifications (he intended to do so), so I showed him how to run darcs record and darcs send. I operated under the assumption that because he was on a win32 box without an MTA set up correctly, it would fail horribly.

darcs send is a killer feature. Anyone with a checked out darcs repo can use it to send all the darcs patches upstream via SMTP. The patches arrive in the mailbox of the leader developer, and he can choose to apply them or not. No commit access is required. Anyone can do this. People can trade patches in high-fidelity, version controlled fashion.

I could not have been more wrong. It worked fine. It launched thunderbird and sent the email after simple thunderbird "[x] don't ask me again, okay/cancel" click through.

Oh Emm Eff Gee. It worked. Not only did it work, it REALLY worked. No hacking, no unix software installed, no SSH keys or logins. It just worked.

I intend to give a talk at humbug about darcs at some point in the next few weeks. I just have to write up some slides I guess.

'rati tags:


Anonymous said...

Ok, this is has nothing to do with darcs (which is really cool btw; I love sideways pushes), but what's wrong with wget?

Anonymous said...

Looks like he wanted a web interface to type in the urls.

If not, the "-i" option of wget is your friend :-)

Anonymous said...

I'm curious. How did the service work. Do you run a "download server" that just waits for new urls, or do you just run a cron job?

Anonymous said...

I solved this problem with firefox extensions:
and Linky (or Down-them-All if you wanted to download the links.

Thanks for the darcs tidbit though.