Saturday, February 28, 2009

Merge Bazaar Repositories With No Common Ancestor


Distributed version control is great for merging. Things like bazaar, git, mercurial, etc. all have sophisticated tools and good support for merging branches of the same code that have diverged even if files have been moved or renamed. But what about merging branches with no common ancestor? I needed to do just that today. I had two bazaar repositories that were separate parts of the same project. One repository was the client and one held the server. I decided that it was pretty inconvenient and a bad idea to have them in separate repositories. I wanted to merge the repositories so I wouldn't lose the history for either project.

Turns out this is pretty easy... In bazaar you can simply do the following:
  • Change directory to the destination working copy.
  • Execute the following command
    bzr merge /path/to/source-working-copy -r0..-1
  • Note the -r0..-1 part of the command. This tells bazaar to merge a range of revisions from the first revision to the most current.
  • Now review and commit the changes. Notice that bazaar gives you an indication that all history is preserved by displaying a list of checkin comments. Nice.
Now the destination working copy will contain all the code and history from the source working copy. Cool. I used this to merge the server codebase into the client codebase for the shellsink project. Of course I tagged and annotated this command in shellsink. On my list of things to do is hook into the blogger api from shellsink so that you can have annotated commands from shellsink automatically show up on your blog, but that is for another post...

Thursday, February 26, 2009

App Engine gets bad gas mileage


A few months ago I wrote an app for google app engine, and less than a month ago I told people about it. One of the reasons I chose app engine was that it boasted a generous free quota allowing you to host applications serving nearly a million requests a month for free... Now in theory this might be possible, but in my case I am about to outgrow the free quota in less than a month by serving up about 7 to 10 thousand requests per day. The google ads I put on the site don't make any money because most people interact with the application via the command line, doing pushes and pulls.

When I run out of free quota then it will mean that everyone who wants to keep using shellsink will have to go out and setup their own app engine account so they can deploy shellsink. I'm pretty bummed about this. I have sent a request to google to lift the quota from my application so I don't have to pay, but I don't expect that to work. The only chance I see for shellsink to be saved would be for someone at google who uses shellsink to take the project under their wing so that the quota monster will go away. Bad quota monster!

Update: There is a thread in shellsink's quiet little google group about this.

More information can be found at the shellsink blog.

Sunday, February 8, 2009

The Unicorn of HTTP responses


Hyper Text error codes are generally unwelcome, but there is one error code that is pure magic and some day I hope to see it. That is error 418. Let me share the meaning of the elusive 418.

418 - I'm a teapot

Any attempt to brew coffee with a teapot should result in the error
code "418 I'm a teapot". The resulting entity body MAY be short and
stout.

To understand when you might need that particular error code it helps to know about RFC 2324, which describes HTCPCP, a protocol for controlling, monitoring, and diagnosing coffee pots. So, if your coffee pot turns out to be a teapot you get a 418 and rightly so. Emacs (being somewhat of a unicorn itself) includes a full implementation of the protocol, and there are patches for firefox. Oh dear. I must be going. A rabbit in a waistcoat just ran by and dropped his pocket watch. I'd better return it.

shellsink works for zsh too


If you are a zsh lover you too can have your shell history in the cloud. Check out these simple instructions.

See this post if you don't know what shellsink is.

Saturday, February 7, 2009

Old Skool Pair Programming

I just found this great video about programming a DEC PDP-11. Pair programming for old skool programmers was all about toggling switches representing octal digits and feeding paper tapes.



Make sure you watch all four parts. Now I am going to download the PDP-11 Emulator and do some TDD with it.

Friday, February 6, 2009

Bash History In The Cloud

Since I began programming I have worked on at least a hundred different computers: university workstations, my own computers, dozens of employer and client workstations. Each one had a history file loaded with commands that I begged, borrowed, stole, sweated and cried for. Countless hours of work now long gone or rotting somewhere in a stack of backups.

Everyone, please. A moment of silence for all the shell commands that have gone into the bit bucket never to be heard from again. Even the mean ones that hosed my system. Especially those.

Ladies and Gentlemen I come before you now to swear that never again will I lose this information. Now with shell-sink I keep all that lovely data handy no matter where I am. On top of that I can organize and group useful sets of commands and have them at my fingertips when I need them. I dedicate the Shell-sink tool to the memory of all those late night sed and awk one liners that have saved millions of lives, but faded from memory all too quickly.

Features include:

  • Permanent and unlimited storage of bash history
  • Pull commands back out of the sink and into your shell based on a tag or keyword
  • Searchable bash history
  • Tagable bash history
  • Annotateable bash history
  • Aggregate bash history from multiple computers into one grand unified history
  • RSS feed of your bash history that you can filter
Shell-sink stores your bash history in Google's big table. Development is ongoing. And I have an ever growing feature list including command statistics, and powerful ways to share and document groups of commands.

A guide to get started can be found here. Debian/Ubuntu packages exist to make installation and updates a snap. But installation is pretty easy on other unix based systems. So far nobody has used the sink but me, so if you try it out please drop me a line with some feedback. There is a google group that would be a perfect place to leave feedback.