| ... | @@ -151,7 +151,7 @@ class Note < ActiveRecord::Base |
... | @@ -151,7 +151,7 @@ class Note < ActiveRecord::Base |
|
|
)
|
|
)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def create_new_commits_note(merge_request, project, author, new_commits, existing_commits = [])
|
|
def create_new_commits_note(merge_request, project, author, new_commits, existing_commits = [], oldrev = nil)
|
|
|
total_count = new_commits.length + existing_commits.length
|
|
total_count = new_commits.length + existing_commits.length
|
|
|
commits_text = ActionController::Base.helpers.pluralize(total_count, 'commit')
|
|
commits_text = ActionController::Base.helpers.pluralize(total_count, 'commit')
|
|
|
body = "Added #{commits_text}:\n\n"
|
|
body = "Added #{commits_text}:\n\n"
|
| ... | @@ -160,9 +160,13 @@ class Note < ActiveRecord::Base |
... | @@ -160,9 +160,13 @@ class Note < ActiveRecord::Base |
|
|
commit_ids =
|
|
commit_ids =
|
|
|
if existing_commits.length == 1
|
|
if existing_commits.length == 1
|
|
|
existing_commits.first.short_id
|
|
existing_commits.first.short_id
|
|
|
|
else
|
|
|
|
if oldrev
|
|
|
|
"#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}"
|
|
|
else
|
|
else
|
|
|
"#{existing_commits.first.short_id}..#{existing_commits.last.short_id}"
|
|
"#{existing_commits.first.short_id}..#{existing_commits.last.short_id}"
|
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
commits_text = ActionController::Base.helpers.pluralize(existing_commits.length, 'commit')
|
|
commits_text = ActionController::Base.helpers.pluralize(existing_commits.length, 'commit')
|
|
|
|
|
|
| ... | |
... | |
| ... | | ... | |