Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-07-23 22:29:12 +0300
committerMatija Čupić <matteeyah@gmail.com>2019-07-26 01:17:52 +0300
commit38ab1ae2f200e2071ea7329e106beb1b9232f44c (patch)
tree48f38c5e0749501ba6652b7062f677d5cda4adbf /app/models/project.rb
parent1eab06571496c1b7950dc081435fa21058b614c8 (diff)
Rename latest_successful to be more explicit
* Reword Project#latest_successful_build_for to Project#latest_successful_build_for_ref * Reword Ci::Pipeline#latest_successful_for to Ci::Pipeline#latest_successful_build_for_ref
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 9616e8c9748..dd0922a2fbf 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -720,16 +720,16 @@ class Project < ApplicationRecord
end
# ref can't be HEAD, can only be branch/tag name
- def latest_successful_build_for(job_name, ref = default_branch)
+ def latest_successful_build_for_ref(job_name, ref = default_branch)
return unless ref
- latest_pipeline = ci_pipelines.latest_successful_for(ref)
+ latest_pipeline = ci_pipelines.latest_successful_for_ref(ref)
return unless latest_pipeline
latest_pipeline.builds.latest.with_artifacts_archive.find_by(name: job_name)
end
- def latest_successful_build_for_sha(job_name, sha = commit(default_branch).id)
+ def latest_successful_build_for_sha(job_name, sha)
return unless sha
latest_pipeline = ci_pipelines.latest_successful_for_sha(sha)
@@ -738,8 +738,8 @@ class Project < ApplicationRecord
latest_pipeline.builds.latest.with_artifacts_archive.find_by(name: job_name)
end
- def latest_successful_build_for!(job_name, ref = default_branch)
- latest_successful_build_for(job_name, ref) || raise(ActiveRecord::RecordNotFound.new("Couldn't find job #{job_name}"))
+ def latest_successful_build_for_ref!(job_name, ref = default_branch)
+ latest_successful_build_for_ref(job_name, ref) || raise(ActiveRecord::RecordNotFound.new("Couldn't find job #{job_name}"))
end
def merge_base_commit(first_commit_id, second_commit_id)
@@ -1514,12 +1514,12 @@ class Project < ApplicationRecord
end
@latest_successful_pipeline_for_default_branch =
- ci_pipelines.latest_successful_for(default_branch)
+ ci_pipelines.latest_successful_for_ref(default_branch)
end
def latest_successful_pipeline_for(ref = nil)
if ref && ref != default_branch
- ci_pipelines.latest_successful_for(ref)
+ ci_pipelines.latest_successful_for_ref(ref)
else
latest_successful_pipeline_for_default_branch
end