They break often so we should think, longer-term, about removing it
altogether but may as well give users fair warning before that point.
ClosesHomebrew/homebrew#24220.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Previously if a bottle had no checksum for a particular platform (i.e.
currently there are no Mavericks bottles) then it would generate a
different revision (and thus filename) to the rest of the bottles being
generated which meant bottles needed to be manually renamed.
Instead check the actual bottle object's checksums to make sure that
we've looked at the previous bottles for all platforms rather than just
the current one.
brew versions is hardcoded to cd to HOMEBREW_REPOSITORY before running
git, and as such fails to report previous versions for any formulae
from a tapped repository.
Add two new private methods repository and entry_name to replace the
hardcoded HOMEBREW_REPOSITORY and formula path, and brew versions
work for both builtin and tapped formulae.
ClosesHomebrew/homebrew#12356.
ClosesHomebrew/homebrew#19069.
Reported-by: Misty De Meo <mistydemeo@gmail.com>
Suggested-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
'which' only returns a Pathname or nil, and doesn't care about anything
sent to stderr, so just silence it by default and combine the two
methods.
ClosesHomebrew/homebrew#12115.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Now we handle some things more explicitly and in the process get rid of
the blanket rescue on the mktemp block, which is something of an
antipattern.
By unloading the class *after* determining the version, we avoid the
case where the class had previously been unloaded but Formula.factory
failed, and trying to unload the nonexistent class results in a
NameError. Doing it this way, we avoid having to rescue NameError and
thereby avoid hiding other cases where it may occur.
We also rescue TypeError which gets us past a few more bad formula in
the history in some instances.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This is silly, but I am no Rubyist and I don't have time to
figure out why Formula.factory(foo).url works as expected but
Formula.factory(foo).version does not.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This will be useful for shell tab completion when something like `brew
install <formula> --version <version>` is implemented.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Rather than regex the output of `git show <rev>:<path>`, we write the
output of `git cat-file blog <rev>:<path>` to a temporary file, and then
operate on it just as we would a normal formula.
I haven't observed any speed difference. `git cat-file blob` is faster
than `git show`, but the "slow part" is still the git-rev-list
invocation. But really it's pretty fast overall.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
The output happens as it is determined, rather than all at once, which is preferable for CLI commands. This meant I had to hard-code the left-justification.
The pre-amble warning is removed. Instead the command outputs the git checkout command for each she that you can type to get that old formula.
I decided that reseting the one file will work 99% of the time and that it is too risky to reset the whole repo, this will roll-back bug fixes. Instead we should add functionality to compat/ in order to support old formula as required. Sometimes deps may have to be rolled-back too, but the user will have to figure this out on an ad-hoc basis. We are assuming a failure sophisticated user anyway, one who would like to get old versions of stuff.
I moved most of the functions into Formula since IMO this makes more conceptual sense.
I made the she get abbreviated by git (using --abbrev-commit) itself so it as short as can be.