Show More
@@ -271,14 +271,14 b' class ChangesetController(BaseRepoContro' | |||
|
271 | 271 | context_lcl = get_line_ctx('', request.GET) |
|
272 | 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 | 275 | ignore_whitespace=ign_whitespace_lcl, context=context_lcl) |
|
276 | 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 | 277 | file_diff_data = [] |
|
281 | 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 | 282 | _parsed = diff_processor.prepare() |
|
283 | 283 | c.limited_diff = False |
|
284 | 284 | if isinstance(_parsed, LimitedDiffContainer): |
@@ -295,8 +295,7 b' class ChangesetController(BaseRepoContro' | |||
|
295 | 295 | file_diff_data.append((fid, url_fid, f['operation'], f['old_filename'], filename, diff, st)) |
|
296 | 296 | else: |
|
297 | 297 | # downloads/raw we only need RAW diff nothing else |
|
298 | diff = diff_processor.as_raw() | |
|
299 | file_diff_data.append(('', None, None, None, diff, None)) | |
|
298 | file_diff_data.append(('', None, None, None, raw_diff, None)) | |
|
300 | 299 | c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data) |
|
301 | 300 | |
|
302 | 301 | # sort comments in creation order |
@@ -315,14 +314,14 b' class ChangesetController(BaseRepoContro' | |||
|
315 | 314 | response.content_type = 'text/plain' |
|
316 | 315 | response.content_disposition = 'attachment; filename=%s.diff' \ |
|
317 | 316 | % revision[:12] |
|
318 | return diff | |
|
317 | return raw_diff | |
|
319 | 318 | elif method == 'patch': |
|
320 | 319 | response.content_type = 'text/plain' |
|
321 | c.diff = safe_unicode(diff) | |
|
320 | c.diff = safe_unicode(raw_diff) | |
|
322 | 321 | return render('changeset/patch_changeset.html') |
|
323 | 322 | elif method == 'raw': |
|
324 | 323 | response.content_type = 'text/plain' |
|
325 | return diff | |
|
324 | return raw_diff | |
|
326 | 325 | elif method == 'show': |
|
327 | 326 | self.__load_data() |
|
328 | 327 | if len(c.cs_ranges) == 1: |
@@ -59,10 +59,21 b' class FeedController(BaseRepoController)' | |||
|
59 | 59 | def _get_title(self, cs): |
|
60 | 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 | 73 | changes = [] |
|
64 | 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 | 77 | diff_limit=diff_limit) |
|
67 | 78 | _parsed = diff_processor.prepare(inline_diff=False) |
|
68 | 79 | limited_diff = False |
@@ -78,19 +89,7 b' class FeedController(BaseRepoController)' | |||
|
78 | 89 | if limited_diff: |
|
79 | 90 | changes = changes + ['\n ' + |
|
80 | 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 | 93 | # rev link |
|
95 | 94 | _url = h.canonical_url('changeset_home', repo_name=c.db_repo.repo_name, |
|
96 | 95 | revision=cs.raw_id) |
@@ -102,7 +101,7 b' class FeedController(BaseRepoController)' | |||
|
102 | 101 | desc_msg.extend(changes) |
|
103 | 102 | if str2bool(CONFIG.get('rss_include_diff', False)): |
|
104 | 103 | desc_msg.append('\n\n') |
|
105 |
desc_msg.append(diff |
|
|
104 | desc_msg.append(raw_diff) | |
|
106 | 105 | desc_msg.append('</pre>') |
|
107 | 106 | return map(safe_unicode, desc_msg) |
|
108 | 107 |
@@ -651,25 +651,22 b' class FilesController(BaseRepoController' | |||
|
651 | 651 | f_path=f_path)) |
|
652 | 652 | |
|
653 | 653 | if c.action == 'download': |
|
654 | _diff = diffs.get_gitdiff(node1, node2, | |
|
654 | raw_diff = diffs.get_gitdiff(node1, node2, | |
|
655 | 655 | ignore_whitespace=ignore_whitespace, |
|
656 | 656 | context=line_context) |
|
657 | diff = diffs.DiffProcessor(_diff) | |
|
658 | ||
|
659 | 657 | diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
|
660 | 658 | response.content_type = 'text/plain' |
|
661 | 659 | response.content_disposition = ( |
|
662 | 660 | 'attachment; filename=%s' % diff_name |
|
663 | 661 | ) |
|
664 |
return diff |
|
|
662 | return raw_diff | |
|
665 | 663 | |
|
666 | 664 | elif c.action == 'raw': |
|
667 | _diff = diffs.get_gitdiff(node1, node2, | |
|
665 | raw_diff = diffs.get_gitdiff(node1, node2, | |
|
668 | 666 | ignore_whitespace=ignore_whitespace, |
|
669 | 667 | context=line_context) |
|
670 | diff = diffs.DiffProcessor(_diff) | |
|
671 | 668 | response.content_type = 'text/plain' |
|
672 |
return diff |
|
|
669 | return raw_diff | |
|
673 | 670 | |
|
674 | 671 | else: |
|
675 | 672 | fid = h.FID(diff2, node2.path) |
@@ -592,12 +592,6 b' class DiffProcessor(object):' | |||
|
592 | 592 | self.parsed_diff = parsed |
|
593 | 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 | 595 | def as_html(self, table_class='code-difftable', line_class='line', |
|
602 | 596 | old_lineno_class='lineno old', new_lineno_class='lineno new', |
|
603 | 597 | no_lineno_class='lineno', |
General Comments 0
You need to be logged in to leave comments.
Login now