Wednesday, September 30th, 2009
Today I’m letting the world know about a little something I’ve been working on. It’s called guess-renames.
guess-renames solves a simple problem: Rename several files, either by hand or with a refactoring tool, and your version control system gets horribly confused and you have to spend 20 minutes running the same commands over and over again.1
No more. Now, just run guess-renames and presto, you’re up to date. No more commands to run, just commit. guess-renames is even smart enough to identify renamed files even if their contents differ slightly.
I’ve written a brief description of the algorithm — originally designed by Aaron Bentley for Bazaar — and I won’t reprint it here, but I do want to note just how smart this thing is: Aaron ran a test on the entire Launchpad source tree. First, he rewound the contents of each file 300 revisions; and then he renamed every single one. Except for empty files2, guess-renames was right 100% of the time. Maybe I’m just a dork, but to me that’s so incredibly huge.
This is seriously really cool stuff. I encourage you to take guess-renames for a spin.