diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -271,14 +271,14 @@ class ChangesetController(BaseRepoContro
context_lcl = get_line_ctx('', request.GET)
ign_whitespace_lcl = get_ignore_ws('', request.GET)
- _diff = c.db_repo_scm_instance.get_diff(cs1, cs2,
+ raw_diff = c.db_repo_scm_instance.get_diff(cs1, cs2,
ignore_whitespace=ign_whitespace_lcl, context=context_lcl)
diff_limit = None if c.fulldiff else self.cut_off_limit
- diff_processor = diffs.DiffProcessor(_diff,
- vcs=c.db_repo_scm_instance.alias,
- diff_limit=diff_limit)
file_diff_data = []
if method == 'show':
+ diff_processor = diffs.DiffProcessor(raw_diff,
+ vcs=c.db_repo_scm_instance.alias,
+ diff_limit=diff_limit)
_parsed = diff_processor.prepare()
c.limited_diff = False
if isinstance(_parsed, LimitedDiffContainer):
@@ -295,8 +295,7 @@ class ChangesetController(BaseRepoContro
file_diff_data.append((fid, url_fid, f['operation'], f['old_filename'], filename, diff, st))
else:
# downloads/raw we only need RAW diff nothing else
- diff = diff_processor.as_raw()
- file_diff_data.append(('', None, None, None, diff, None))
+ file_diff_data.append(('', None, None, None, raw_diff, None))
c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data)
# sort comments in creation order
@@ -315,14 +314,14 @@ class ChangesetController(BaseRepoContro
response.content_type = 'text/plain'
response.content_disposition = 'attachment; filename=%s.diff' \
% revision[:12]
- return diff
+ return raw_diff
elif method == 'patch':
response.content_type = 'text/plain'
- c.diff = safe_unicode(diff)
+ c.diff = safe_unicode(raw_diff)
return render('changeset/patch_changeset.html')
elif method == 'raw':
response.content_type = 'text/plain'
- return diff
+ return raw_diff
elif method == 'show':
self.__load_data()
if len(c.cs_ranges) == 1:
diff --git a/kallithea/controllers/feed.py b/kallithea/controllers/feed.py
--- a/kallithea/controllers/feed.py
+++ b/kallithea/controllers/feed.py
@@ -59,10 +59,21 @@ class FeedController(BaseRepoController)
def _get_title(self, cs):
return h.shorter(cs.message, 160)
- def __changes(self, cs):
+ def __get_desc(self, cs):
+ desc_msg = [(_('%s committed on %s')
+ % (h.person(cs.author), h.fmt_date(cs.date))) + '
']
+ # branches, tags, bookmarks
+ if cs.branch:
+ desc_msg.append('branch: %s
' % cs.branch)
+ for book in cs.bookmarks:
+ desc_msg.append('bookmark: %s
' % book)
+ for tag in cs.tags:
+ desc_msg.append('tag: %s
' % tag)
+
changes = []
diff_limit = safe_int(CONFIG.get('rss_cut_off_limit', 32 * 1024))
- diff_processor = DiffProcessor(cs.diff(),
+ raw_diff = cs.diff()
+ diff_processor = DiffProcessor(raw_diff,
diff_limit=diff_limit)
_parsed = diff_processor.prepare(inline_diff=False)
limited_diff = False
@@ -78,19 +89,7 @@ class FeedController(BaseRepoController)
if limited_diff:
changes = changes + ['\n ' +
_('Changeset was too big and was cut off...')]
- return diff_processor, changes
- def __get_desc(self, cs):
- desc_msg = [(_('%s committed on %s')
- % (h.person(cs.author), h.fmt_date(cs.date))) + '
']
- # branches, tags, bookmarks
- if cs.branch:
- desc_msg.append('branch: %s
' % cs.branch)
- for book in cs.bookmarks:
- desc_msg.append('bookmark: %s
' % book)
- for tag in cs.tags:
- desc_msg.append('tag: %s
' % tag)
- diff_processor, changes = self.__changes(cs)
# rev link
_url = h.canonical_url('changeset_home', repo_name=c.db_repo.repo_name,
revision=cs.raw_id)
@@ -102,7 +101,7 @@ class FeedController(BaseRepoController)
desc_msg.extend(changes)
if str2bool(CONFIG.get('rss_include_diff', False)):
desc_msg.append('\n\n')
- desc_msg.append(diff_processor.as_raw())
+ desc_msg.append(raw_diff)
desc_msg.append('')
return map(safe_unicode, desc_msg)
diff --git a/kallithea/controllers/files.py b/kallithea/controllers/files.py
--- a/kallithea/controllers/files.py
+++ b/kallithea/controllers/files.py
@@ -651,25 +651,22 @@ class FilesController(BaseRepoController
f_path=f_path))
if c.action == 'download':
- _diff = diffs.get_gitdiff(node1, node2,
+ raw_diff = diffs.get_gitdiff(node1, node2,
ignore_whitespace=ignore_whitespace,
context=line_context)
- diff = diffs.DiffProcessor(_diff)
-
diff_name = '%s_vs_%s.diff' % (diff1, diff2)
response.content_type = 'text/plain'
response.content_disposition = (
'attachment; filename=%s' % diff_name
)
- return diff.as_raw()
+ return raw_diff
elif c.action == 'raw':
- _diff = diffs.get_gitdiff(node1, node2,
+ raw_diff = diffs.get_gitdiff(node1, node2,
ignore_whitespace=ignore_whitespace,
context=line_context)
- diff = diffs.DiffProcessor(_diff)
response.content_type = 'text/plain'
- return diff.as_raw()
+ return raw_diff
else:
fid = h.FID(diff2, node2.path)
diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py
--- a/kallithea/lib/diffs.py
+++ b/kallithea/lib/diffs.py
@@ -592,12 +592,6 @@ class DiffProcessor(object):
self.parsed_diff = parsed
return parsed
- def as_raw(self):
- """
- Returns raw string diff, exactly as it was passed in the first place.
- """
- return self._diff
-
def as_html(self, table_class='code-difftable', line_class='line',
old_lineno_class='lineno old', new_lineno_class='lineno new',
no_lineno_class='lineno',