changeset 8860:51af759ef518

diffs: generalize name of DiffProcessor argument inline_diff to "html"
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 16 Feb 2021 22:56:53 +0100
parents 4fb8e175cbb9
children 99ffd118f6af
files kallithea/controllers/feed.py kallithea/lib/diffs.py
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/feed.py	Tue Feb 16 21:59:00 2021 +0100
+++ b/kallithea/controllers/feed.py	Tue Feb 16 22:56:53 2021 +0100
@@ -71,7 +71,7 @@
         raw_diff = cs.diff()
         diff_processor = DiffProcessor(raw_diff,
                                        diff_limit=diff_limit,
-                                       inline_diff=False)
+                                       html=False)
 
         for st in diff_processor.parsed:
             st.update({'added': st['stats']['added'],
--- a/kallithea/lib/diffs.py	Tue Feb 16 21:59:00 2021 +0100
+++ b/kallithea/lib/diffs.py	Tue Feb 16 22:56:53 2021 +0100
@@ -190,7 +190,7 @@
         raw_diff = get_gitdiff(filenode_old, filenode_new,
                                 ignore_whitespace=ignore_whitespace,
                                 context=line_context)
-        diff_processor = DiffProcessor(raw_diff)
+        diff_processor = DiffProcessor(raw_diff, html=True)
         if diff_processor.parsed: # there should be exactly one element, for the specified file
             f = diff_processor.parsed[0]
             op = f['operation']
@@ -266,11 +266,11 @@
     """
     Give it a unified or git diff and it returns a list of the files that were
     mentioned in the diff together with a dict of meta information that
-    can be used to render it in a HTML template.
+    can be used to render it in a HTML template or as text.
     """
     _diff_git_re = re.compile(b'^diff --git', re.MULTILINE)
 
-    def __init__(self, diff, vcs='hg', diff_limit=None, inline_diff=True):
+    def __init__(self, diff, vcs='hg', diff_limit=None, html=True):
         """
         :param diff:   a text in diff format
         :param vcs: type of version control hg or git
@@ -287,9 +287,9 @@
         self.diff_limit = diff_limit
         self.limited_diff = False
         self.vcs = vcs
-        self.parsed = self._parse_gitdiff(inline_diff=inline_diff)
+        self.parsed = self._parse_gitdiff(html=html)
 
-    def _parse_gitdiff(self, inline_diff):
+    def _parse_gitdiff(self, html):
         """Parse self._diff and return a list of dicts with meta info and chunks for each file.
         Might set limited_diff.
         Optionally, do an extra pass and to extra markup of one-liner changes.
@@ -399,7 +399,7 @@
                 'stats':            stats,
             })
 
-        if not inline_diff:
+        if not html:
             return _files
 
         # highlight inline changes when one del is followed by one add