From ca936d2784773652530e7b02af40b925ca45a4d6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 11 Dec 2012 06:14:05 +0300 Subject: Improve CI integration for merge requests --- app/models/merge_request.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models/merge_request.rb') diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8039813ad1c..2409fb80acb 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -220,4 +220,8 @@ class MergeRequest < ActiveRecord::Base def to_patch project.repo.git.format_patch({timeout: 30, raise: true, stdout: true}, "#{target_branch}..#{source_branch}") end + + def last_commit_short_sha + @last_commit_short_sha ||= last_commit.sha[0..10] + end end -- cgit v1.2.1 From 9ada67881970b05d4be49cbe329b4bf50ffe4f77 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 18 Dec 2012 20:02:00 +0200 Subject: Split commit_id and noteable_id for Note --- app/models/merge_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/merge_request.rb') diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 2409fb80acb..052e0850d96 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -204,7 +204,7 @@ class MergeRequest < ActiveRecord::Base def mr_and_commit_notes commit_ids = commits.map(&:id) - Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) + Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) end # Returns the raw diff for this merge request -- cgit v1.2.1