Show More
@@ -271,14 +271,14 b' class ChangesetController(BaseRepoContro' | |||||
271 | context_lcl = get_line_ctx('', request.GET) |
|
271 | context_lcl = get_line_ctx('', request.GET) | |
272 | ign_whitespace_lcl = get_ignore_ws('', request.GET) |
|
272 | ign_whitespace_lcl = get_ignore_ws('', request.GET) | |
273 |
|
273 | |||
274 | _diff = c.db_repo_scm_instance.get_diff(cs1, cs2, |
|
274 | raw_diff = c.db_repo_scm_instance.get_diff(cs1, cs2, | |
275 | ignore_whitespace=ign_whitespace_lcl, context=context_lcl) |
|
275 | ignore_whitespace=ign_whitespace_lcl, context=context_lcl) | |
276 | diff_limit = None if c.fulldiff else self.cut_off_limit |
|
276 | diff_limit = None if c.fulldiff else self.cut_off_limit | |
277 | diff_processor = diffs.DiffProcessor(_diff, |
|
|||
278 | vcs=c.db_repo_scm_instance.alias, |
|
|||
279 | diff_limit=diff_limit) |
|
|||
280 | file_diff_data = [] |
|
277 | file_diff_data = [] | |
281 | if method == 'show': |
|
278 | if method == 'show': | |
|
279 | diff_processor = diffs.DiffProcessor(raw_diff, | |||
|
280 | vcs=c.db_repo_scm_instance.alias, | |||
|
281 | diff_limit=diff_limit) | |||
282 | _parsed = diff_processor.prepare() |
|
282 | _parsed = diff_processor.prepare() | |
283 | c.limited_diff = False |
|
283 | c.limited_diff = False | |
284 | if isinstance(_parsed, LimitedDiffContainer): |
|
284 | if isinstance(_parsed, LimitedDiffContainer): | |
@@ -295,8 +295,7 b' class ChangesetController(BaseRepoContro' | |||||
295 | file_diff_data.append((fid, url_fid, f['operation'], f['old_filename'], filename, diff, st)) |
|
295 | file_diff_data.append((fid, url_fid, f['operation'], f['old_filename'], filename, diff, st)) | |
296 | else: |
|
296 | else: | |
297 | # downloads/raw we only need RAW diff nothing else |
|
297 | # downloads/raw we only need RAW diff nothing else | |
298 | diff = diff_processor.as_raw() |
|
298 | file_diff_data.append(('', None, None, None, raw_diff, None)) | |
299 | file_diff_data.append(('', None, None, None, diff, None)) |
|
|||
300 | c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data) |
|
299 | c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data) | |
301 |
|
300 | |||
302 | # sort comments in creation order |
|
301 | # sort comments in creation order | |
@@ -315,14 +314,14 b' class ChangesetController(BaseRepoContro' | |||||
315 | response.content_type = 'text/plain' |
|
314 | response.content_type = 'text/plain' | |
316 | response.content_disposition = 'attachment; filename=%s.diff' \ |
|
315 | response.content_disposition = 'attachment; filename=%s.diff' \ | |
317 | % revision[:12] |
|
316 | % revision[:12] | |
318 | return diff |
|
317 | return raw_diff | |
319 | elif method == 'patch': |
|
318 | elif method == 'patch': | |
320 | response.content_type = 'text/plain' |
|
319 | response.content_type = 'text/plain' | |
321 | c.diff = safe_unicode(diff) |
|
320 | c.diff = safe_unicode(raw_diff) | |
322 | return render('changeset/patch_changeset.html') |
|
321 | return render('changeset/patch_changeset.html') | |
323 | elif method == 'raw': |
|
322 | elif method == 'raw': | |
324 | response.content_type = 'text/plain' |
|
323 | response.content_type = 'text/plain' | |
325 | return diff |
|
324 | return raw_diff | |
326 | elif method == 'show': |
|
325 | elif method == 'show': | |
327 | self.__load_data() |
|
326 | self.__load_data() | |
328 | if len(c.cs_ranges) == 1: |
|
327 | if len(c.cs_ranges) == 1: |
@@ -59,10 +59,21 b' class FeedController(BaseRepoController)' | |||||
59 | def _get_title(self, cs): |
|
59 | def _get_title(self, cs): | |
60 | return h.shorter(cs.message, 160) |
|
60 | return h.shorter(cs.message, 160) | |
61 |
|
61 | |||
62 |
def __ |
|
62 | def __get_desc(self, cs): | |
|
63 | desc_msg = [(_('%s committed on %s') | |||
|
64 | % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>'] | |||
|
65 | # branches, tags, bookmarks | |||
|
66 | if cs.branch: | |||
|
67 | desc_msg.append('branch: %s<br/>' % cs.branch) | |||
|
68 | for book in cs.bookmarks: | |||
|
69 | desc_msg.append('bookmark: %s<br/>' % book) | |||
|
70 | for tag in cs.tags: | |||
|
71 | desc_msg.append('tag: %s<br/>' % tag) | |||
|
72 | ||||
63 | changes = [] |
|
73 | changes = [] | |
64 | diff_limit = safe_int(CONFIG.get('rss_cut_off_limit', 32 * 1024)) |
|
74 | diff_limit = safe_int(CONFIG.get('rss_cut_off_limit', 32 * 1024)) | |
65 |
diff |
|
75 | raw_diff = cs.diff() | |
|
76 | diff_processor = DiffProcessor(raw_diff, | |||
66 | diff_limit=diff_limit) |
|
77 | diff_limit=diff_limit) | |
67 | _parsed = diff_processor.prepare(inline_diff=False) |
|
78 | _parsed = diff_processor.prepare(inline_diff=False) | |
68 | limited_diff = False |
|
79 | limited_diff = False | |
@@ -78,19 +89,7 b' class FeedController(BaseRepoController)' | |||||
78 | if limited_diff: |
|
89 | if limited_diff: | |
79 | changes = changes + ['\n ' + |
|
90 | changes = changes + ['\n ' + | |
80 | _('Changeset was too big and was cut off...')] |
|
91 | _('Changeset was too big and was cut off...')] | |
81 | return diff_processor, changes |
|
|||
82 |
|
92 | |||
83 | def __get_desc(self, cs): |
|
|||
84 | desc_msg = [(_('%s committed on %s') |
|
|||
85 | % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>'] |
|
|||
86 | # branches, tags, bookmarks |
|
|||
87 | if cs.branch: |
|
|||
88 | desc_msg.append('branch: %s<br/>' % cs.branch) |
|
|||
89 | for book in cs.bookmarks: |
|
|||
90 | desc_msg.append('bookmark: %s<br/>' % book) |
|
|||
91 | for tag in cs.tags: |
|
|||
92 | desc_msg.append('tag: %s<br/>' % tag) |
|
|||
93 | diff_processor, changes = self.__changes(cs) |
|
|||
94 | # rev link |
|
93 | # rev link | |
95 | _url = h.canonical_url('changeset_home', repo_name=c.db_repo.repo_name, |
|
94 | _url = h.canonical_url('changeset_home', repo_name=c.db_repo.repo_name, | |
96 | revision=cs.raw_id) |
|
95 | revision=cs.raw_id) | |
@@ -102,7 +101,7 b' class FeedController(BaseRepoController)' | |||||
102 | desc_msg.extend(changes) |
|
101 | desc_msg.extend(changes) | |
103 | if str2bool(CONFIG.get('rss_include_diff', False)): |
|
102 | if str2bool(CONFIG.get('rss_include_diff', False)): | |
104 | desc_msg.append('\n\n') |
|
103 | desc_msg.append('\n\n') | |
105 |
desc_msg.append(diff |
|
104 | desc_msg.append(raw_diff) | |
106 | desc_msg.append('</pre>') |
|
105 | desc_msg.append('</pre>') | |
107 | return map(safe_unicode, desc_msg) |
|
106 | return map(safe_unicode, desc_msg) | |
108 |
|
107 |
@@ -651,25 +651,22 b' class FilesController(BaseRepoController' | |||||
651 | f_path=f_path)) |
|
651 | f_path=f_path)) | |
652 |
|
652 | |||
653 | if c.action == 'download': |
|
653 | if c.action == 'download': | |
654 | _diff = diffs.get_gitdiff(node1, node2, |
|
654 | raw_diff = diffs.get_gitdiff(node1, node2, | |
655 | ignore_whitespace=ignore_whitespace, |
|
655 | ignore_whitespace=ignore_whitespace, | |
656 | context=line_context) |
|
656 | context=line_context) | |
657 | diff = diffs.DiffProcessor(_diff) |
|
|||
658 |
|
||||
659 | diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
|
657 | diff_name = '%s_vs_%s.diff' % (diff1, diff2) | |
660 | response.content_type = 'text/plain' |
|
658 | response.content_type = 'text/plain' | |
661 | response.content_disposition = ( |
|
659 | response.content_disposition = ( | |
662 | 'attachment; filename=%s' % diff_name |
|
660 | 'attachment; filename=%s' % diff_name | |
663 | ) |
|
661 | ) | |
664 |
return diff |
|
662 | return raw_diff | |
665 |
|
663 | |||
666 | elif c.action == 'raw': |
|
664 | elif c.action == 'raw': | |
667 | _diff = diffs.get_gitdiff(node1, node2, |
|
665 | raw_diff = diffs.get_gitdiff(node1, node2, | |
668 | ignore_whitespace=ignore_whitespace, |
|
666 | ignore_whitespace=ignore_whitespace, | |
669 | context=line_context) |
|
667 | context=line_context) | |
670 | diff = diffs.DiffProcessor(_diff) |
|
|||
671 | response.content_type = 'text/plain' |
|
668 | response.content_type = 'text/plain' | |
672 |
return diff |
|
669 | return raw_diff | |
673 |
|
670 | |||
674 | else: |
|
671 | else: | |
675 | fid = h.FID(diff2, node2.path) |
|
672 | fid = h.FID(diff2, node2.path) |
@@ -592,12 +592,6 b' class DiffProcessor(object):' | |||||
592 | self.parsed_diff = parsed |
|
592 | self.parsed_diff = parsed | |
593 | return parsed |
|
593 | return parsed | |
594 |
|
594 | |||
595 | def as_raw(self): |
|
|||
596 | """ |
|
|||
597 | Returns raw string diff, exactly as it was passed in the first place. |
|
|||
598 | """ |
|
|||
599 | return self._diff |
|
|||
600 |
|
||||
601 | def as_html(self, table_class='code-difftable', line_class='line', |
|
595 | def as_html(self, table_class='code-difftable', line_class='line', | |
602 | old_lineno_class='lineno old', new_lineno_class='lineno new', |
|
596 | old_lineno_class='lineno old', new_lineno_class='lineno new', | |
603 | no_lineno_class='lineno', |
|
597 | no_lineno_class='lineno', |
General Comments 0
You need to be logged in to leave comments.
Login now