compare: fixed case of cross repo compare before links not working.

This commit is contained in:
Marcin Kuzminski 2018-10-24 14:13:47 +02:00
parent 8d8e2802da
commit f0b9af7b4b
4 changed files with 25 additions and 14 deletions

View file

@ -88,7 +88,7 @@ class TestRepoCommitView(object):
response.mustcontain('21 files changed: 943 inserted, 288 deleted')
# files op files
response.mustcontain('File no longer present at commit: %s' %
response.mustcontain('File not present at commit: %s' %
_shorten_commit_id(commit_id))
# svn uses a different filename
@ -133,7 +133,7 @@ class TestRepoCommitView(object):
response.mustcontain('21 files changed: 943 inserted, 288 deleted')
# files op files
response.mustcontain('File no longer present at commit: %s' %
response.mustcontain('File not present at commit: %s' %
_shorten_commit_id(commit_ids[1]))
response.mustcontain('Added docstrings to vcs.cli') # commit msg
response.mustcontain('Changed theme to ADC theme') # commit msg
@ -163,7 +163,7 @@ class TestRepoCommitView(object):
response.mustcontain(_shorten_commit_id(commit_ids[1]))
# files op files
response.mustcontain('File no longer present at commit: %s' %
response.mustcontain('File not present at commit: %s' %
_shorten_commit_id(commit_ids[1]))
# svn is special

View file

@ -300,6 +300,7 @@ class RepoCompareView(RepoAppView):
diffset = codeblocks.DiffSet(
repo_name=source_repo.repo_name,
source_node_getter=codeblocks.diffset_node_getter(source_commit),
target_repo_name=self.db_repo_name,
target_node_getter=codeblocks.diffset_node_getter(target_commit),
)
c.diffset = self.path_filter.render_patchset_filtered(

View file

@ -377,6 +377,7 @@ class DiffSet(object):
def __init__(self, highlight_mode=HL_REAL, repo_name=None,
source_repo_name=None,
source_node_getter=lambda filename: None,
target_repo_name=None,
target_node_getter=lambda filename: None,
source_nodes=None, target_nodes=None,
# files over this size will use fast highlighting
@ -390,6 +391,7 @@ class DiffSet(object):
self.source_nodes = source_nodes or {}
self.target_nodes = target_nodes or {}
self.repo_name = repo_name
self.target_repo_name = target_repo_name or repo_name
self.source_repo_name = source_repo_name or repo_name
self.max_file_size_limit = max_file_size_limit
@ -402,6 +404,7 @@ class DiffSet(object):
file_stats={},
limited_diff=isinstance(patchset, LimitedDiffContainer),
repo_name=self.repo_name,
target_repo_name=self.target_repo_name,
source_repo_name=self.source_repo_name,
source_ref=source_ref,
target_ref=target_ref,
@ -414,6 +417,7 @@ class DiffSet(object):
target_ref=diffset.target_ref,
repo_name=diffset.repo_name,
source_repo_name=diffset.source_repo_name,
target_repo_name=diffset.target_repo_name,
))
diffset.files.append(filediff)
diffset.changed_files += 1

View file

@ -443,11 +443,14 @@ from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
<%def name="diff_menu(filediff, use_comments=False)">
<div class="filediff-menu">
%if filediff.diffset.source_ref:
%if filediff.diffset.source_ref:
## FILE BEFORE CHANGES
%if filediff.operation in ['D', 'M']:
<a
class="tooltip"
href="${h.route_path('repo_files',repo_name=filediff.diffset.repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
href="${h.route_path('repo_files',repo_name=filediff.diffset.target_repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
>
${_('Show file before')}
@ -455,11 +458,13 @@ from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
%else:
<span
class="tooltip"
title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
title="${h.tooltip(_('File not present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
>
${_('Show file before')}
</span> |
%endif
## FILE AFTER CHANGES
%if filediff.operation in ['A', 'M']:
<a
class="tooltip"
@ -471,20 +476,21 @@ from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
%else:
<span
class="tooltip"
title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
title="${h.tooltip(_('File not present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
>
${_('Show file after')}
</span>
%endif
% if use_comments:
|
<a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
<span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
</a>
% endif
% if use_comments:
|
<a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
<span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
</a>
% endif
%endif
%endif
</div>
</%def>