mxcl/homebrew — pull request #25100 by jacknagel (2013-12-10 02:47:57+00:00)
Title: bottle: determine revision more reliably

While trying to re-bottle erlang, I noticed that the new bottles were not assigned the correct revision.

The code that determines the revision looks into the git history and builds an array of filenames for previous bottles, then increments the revision until it finds one that is not in the list.

It turns out erlang R16B02 never had a revision 0; the first bottle was committed with revision 1, so this heuristic fails.

I've implemented a slightly different approach, while builds a hash that maps versions to arrays of bottle revisions that existed for those versions. If the array for the corresponding version is empty, we know we are at revision 0, otherwise we take the max of that array and increment it to get the new revision.

/cc @mikemcquaid