Add improvements to merge request versions

* show commits count in the merge request version dropdown
* initialize base/start commit sha for old merge request diffs from repo

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2016-07-28 17:26:54 +03:00
parent 964742f600
commit 5cad2d2902
2 changed files with 5 additions and 2 deletions

View file

@ -34,7 +34,9 @@ class MergeRequestDiff < ActiveRecord::Base
if persisted?
# Workaround for old MergeRequestDiff object
# that does not have head_commit_sha in the database
self.head_commit_sha ||= last_commit.sha
self.start_commit_sha ||= merge_request.target_branch_sha
self.head_commit_sha ||= last_commit.sha
self.base_commit_sha ||= find_base_sha
else
self.start_commit_sha ||= merge_request.target_branch_sha
self.head_commit_sha ||= merge_request.source_branch_sha

View file

@ -20,8 +20,9 @@
#{merge_request_diff.head_commit.short_id}
%br
%small
#{number_with_delimiter(merge_request_diff.commits.count)} #{'commit'.pluralize(merge_request_diff.commits.count)},
= time_ago_with_tooltip(merge_request_diff.created_at)
.pull-right
%span.monospace
git diff #{@merge_request_diff.base_commit.short_id}..#{@merge_request_diff.head_commit.short_id}
#{@merge_request_diff.base_commit.short_id}..#{@merge_request_diff.head_commit.short_id}