diff options
| author | Markus Reiter | 2017-06-04 11:59:44 +0200 |
|---|---|---|
| committer | GitHub | 2017-06-04 11:59:44 +0200 |
| commit | 515411707a7617f9ead9e01d5f71e82423af69df (patch) | |
| tree | 006809e6a7b599a560e19d11e9229e5bd4b81bef /Library | |
| parent | a4aacbc15eecb9bb2fc67ab2a70f0e3d35020ba3 (diff) | |
| parent | 8ffc77d8e89ebb1e4895b1d4927f713f182cac66 (diff) | |
| download | brew-515411707a7617f9ead9e01d5f71e82423af69df.tar.bz2 | |
Merge pull request #2727 from reitermarkus/refactor-formula-versions
Refactor `FormulaVersions`.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula_versions.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Library/Homebrew/formula_versions.rb b/Library/Homebrew/formula_versions.rb index dda8dc712..bb6803567 100644 --- a/Library/Homebrew/formula_versions.rb +++ b/Library/Homebrew/formula_versions.rb @@ -17,6 +17,7 @@ class FormulaVersions @repository = formula.tap.path @entry_name = @path.relative_path_from(repository).to_s @current_formula = formula + @formula_at_revision = {} end def rev_list(branch) @@ -32,20 +33,20 @@ class FormulaVersions end def formula_at_revision(rev) - contents = file_contents_at_revision(rev) - - begin - Homebrew.raise_deprecation_exceptions = true - yield nostdout { Formulary.from_contents(name, path, contents) } - rescue *IGNORED_EXCEPTIONS => e - # We rescue these so that we can skip bad versions and - # continue walking the history - ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug? - rescue FormulaUnavailableError - # Suppress this error - ensure - Homebrew.raise_deprecation_exceptions = false + Homebrew.raise_deprecation_exceptions = true + + yield @formula_at_revision[rev] ||= begin + contents = file_contents_at_revision(rev) + nostdout { Formulary.from_contents(name, path, contents) } end + rescue *IGNORED_EXCEPTIONS => e + # We rescue these so that we can skip bad versions and + # continue walking the history + ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug? + rescue FormulaUnavailableError + # Suppress this error + ensure + Homebrew.raise_deprecation_exceptions = false end def bottle_version_map(branch) |
