diff --git a/rhodecode/apps/repository/views/repo_commits.py b/rhodecode/apps/repository/views/repo_commits.py --- a/rhodecode/apps/repository/views/repo_commits.py +++ b/rhodecode/apps/repository/views/repo_commits.py @@ -77,6 +77,7 @@ class RepoCommitsView(RepoAppView): _ = self.request.translate c = self.load_default_context() c.fulldiff = self.request.GET.get('fulldiff') + redirect_to_combined = str2bool(self.request.GET.get('redirect_combined')) # fetch global flags of ignore ws or context lines diff_context = get_diff_context(self.request) @@ -117,6 +118,19 @@ class RepoCommitsView(RepoAppView): raise HTTPNotFound() single_commit = len(c.commit_ranges) == 1 + if redirect_to_combined and not single_commit: + source_ref = getattr(c.commit_ranges[0].parents[0] + if c.commit_ranges[0].parents else h.EmptyCommit(), 'raw_id') + target_ref = c.commit_ranges[-1].raw_id + next_url = h.route_path( + 'repo_compare', + repo_name=c.repo_name, + source_ref_type='rev', + source_ref=source_ref, + target_ref_type='rev', + target_ref=target_ref) + raise HTTPFound(next_url) + c.changes = OrderedDict() c.lines_added = 0 c.lines_deleted = 0 diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -1140,9 +1140,8 @@ label { margin-left: -15px; } -#rev_range_container, #rev_range_clear, #rev_range_more { - margin-top: -5px; - margin-bottom: -5px; +#rev_range_action { + margin-bottom: -8px; } #filter_changelog { diff --git a/rhodecode/templates/commits/changelog.mako b/rhodecode/templates/commits/changelog.mako --- a/rhodecode/templates/commits/changelog.mako +++ b/rhodecode/templates/commits/changelog.mako @@ -108,7 +108,26 @@
- + + + ## commit message expand arrow @@ -147,6 +166,9 @@ var $commitRangeMore = $('#rev_range_more'); var $commitRangeContainer = $('#rev_range_container'); var $commitRangeClear = $('#rev_range_clear'); + var $commitRangeAction = $('#rev_range_action'); + var $commitRangeCombinedUrl = $('#rev_range_combined_url'); + var $compareFork = $('#compare_fork_button'); var checkboxRangeSelector = function(e){ var selectedCheckboxes = []; @@ -169,9 +191,8 @@ } if (selectedCheckboxes.length > 0) { - $('#compare_fork_button').hide(); + $compareFork.hide(); var commitStart = $(selectedCheckboxes[selectedCheckboxes.length-1]).data(); - var revStart = commitStart.commitId; var commitEnd = $(selectedCheckboxes[0]).data(); @@ -181,7 +202,9 @@ var lbl_end = '{0}'.format(commitEnd.commitIdx, commitEnd.shortId); var url = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd}); - var link = _gettext('Show commit range {0} ... {1}').format(lbl_start, lbl_end); + var urlCombined = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd, 'redirect_combined': '1'}); + + var link = _gettext('Show commit range {0}{1}').format(lbl_start, lbl_end); if (selectedCheckboxes.length > 1) { $commitRangeClear.show(); @@ -192,9 +215,12 @@ .html(link) .show(); + $commitRangeCombinedUrl.attr('href', urlCombined); + $commitRangeAction.show(); } else { $commitRangeContainer.hide(); + $commitRangeAction.hide(); $commitRangeClear.show(); $commitRangeMore.show(); } @@ -212,6 +238,7 @@ $commitRangeContainer.hide(); $commitRangeClear.hide(); $commitRangeMore.hide(); + $commitRangeAction.hide(); %if c.branch_name: var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'branch':'${c.branch_name}'}); @@ -220,7 +247,7 @@ var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'}); open_new_pull_request.attr('href', _url); %endif - $('#compare_fork_button').show(); + $compareFork.show(); } };