patch to import Jon Smirl's work from Bitkeeper