diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-07-13 10:10:58 +0200 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-07-13 10:10:58 +0200 |
commit | ac3607285022b3e1b1753da13df5c78a60be26b1 (patch) | |
tree | 8f72d0939810b9ffd1057ff39bc4dcf5232ce931 /app/models/merge_request.rb | |
parent | 5ec5dd0e107211f8ced83fb144f4b21a2a589557 (diff) | |
download | gitorious-mainline-outdated-ac3607285022b3e1b1753da13df5c78a60be26b1.zip gitorious-mainline-outdated-ac3607285022b3e1b1753da13df5c78a60be26b1.tar.gz gitorious-mainline-outdated-ac3607285022b3e1b1753da13df5c78a60be26b1.tar.bz2 |
Reformatted line-length, added a comment about future optimization and
removed debug logger statement
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8f900e1..0778c04 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -498,12 +498,13 @@ class MergeRequest < ActiveRecord::Base versions.blank? ? nil : versions.last.version end - # Verify that +a_commit+ exists in target branch. Git cherry would return a list of commits if this is not the case + # Verify that +a_commit+ exists in target branch. Git cherry would + # return a list of commits if this is not the case def commit_merged?(a_commit) - result = Rails.cache.fetch("merge_status_for_commit_#{a_commit}_in_repository_#{target_repository.id}", - :expires_in => 60.minutes) do + # FIXME: could fetch them all in one target_branch..this_branch operation + key = "merge_status_for_commit_#{a_commit}_in_repository_#{target_repository.id}" + result = Rails.cache.fetch(key, :expires_in => 60.minutes) do output = target_repository.git.git.cherry({},target_branch, a_commit) - RAILS_DEFAULT_LOGGER.info "Cache missed OMGWFTBBQ #{a_commit}" output.blank? ? :true : :false # Storing false in the cache would make it miss each time end result == :true |