summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb36
1 files changed, 17 insertions, 19 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 7c5fdad5122..b45f22d94d9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1306,28 +1306,26 @@ class Project < ActiveRecord::Base
Gitlab::Redis.with { |redis| redis.del(pushes_since_gc_redis_key) }
end
- def environments_for(ref, commit: nil, with_tags: false)
- deployments_query = with_tags ? 'ref = ? OR tag IS TRUE' : 'ref = ?'
-
- environment_ids = deployments
- .where(deployments_query, ref.to_s)
- .group(:environment_id)
- .select(:environment_id)
-
- environments_found = environments.available
- .where(id: environment_ids).to_a
-
- return environments_found unless commit
-
- environments_found.select do |environment|
- environment.includes_commit?(commit)
+ def route_map_for(commit_sha)
+ @route_maps_by_commit ||= Hash.new do |h, sha|
+ h[sha] = begin
+ data = repository.route_map_for(sha)
+ next unless data
+
+ Gitlab::RouteMap.new(data)
+ rescue Gitlab::RouteMap::FormatError
+ nil
+ end
end
+
+ @route_maps_by_commit[commit_sha]
end
- def environments_recently_updated_on_branch(branch)
- environments_for(branch).select do |environment|
- environment.recently_updated_on_branch?(branch)
- end
+ def public_path_for_source_path(path, commit_sha)
+ map = route_map_for(commit_sha)
+ return unless map
+
+ map.public_path_for_source_path(path)
end
private