upgrade: tighten installed precondition
upgrade: use a method rather than a boolean flag
Fix Formula#installed_prefix logic

Due to the precedence of "and" relative to "||", this was not working as
intended; but because #version influences #prefix, the outcome was still
correct. So we can simplify this method quite a bit, and take the
opportunity to share code with #prefix.
Enable tracking of formula revisions

It is useful to be able to prompt upgrades in response to events other
than a version update; for example, when a dependency is updated and its
library version changes, dependents need to be rebuilt to link against
the new library.

Currently we cannot do this automatically, which means a flood of
tickets whenever the library version of a popular library changes.

To address this, we need to track an additional piece of metadata, the
"revision" of the formula, which can be incremented when appropriate to
prompt an upgrade. It can then be reset to zero when the next version
change occurs.
Encode formula revision in installation prefix

In order to allow kegs built with the same version but differing
formula revisions, we must encode the revision as part of the keg's
name. This is necessary to actually *do* the upgrade, as we cannot
upgrade a keg in-place, and temporarily moving it pending the result of
the upgrade is error-prone and potentially slow.

To accomplish this, we tack the revision onto the end of the standard
keg name, preceded by an underscore (e.g. "1.0_1"). Keg#version learns
to parse this format, and stores the revision as an attribute that can
be accessed independently.

An exception is made for a formula that has no revision: the tag is
omitted. This preserves compatibility with existing kegs.
Teach outdated to consider revisions