diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -364,7 +364,7 @@ class DiffProcessor(object): groups = match.groupdict() rest = diff_chunk[match.end():] if rest and not rest.startswith('@') and not rest.startswith('literal ') and not rest.startswith('delta '): - raise Exception('cannot parse diff header: %r followed by %r' % (diff_chunk[:match.end()], rest[:1000])) + raise Exception('cannot parse %s diff header: %r followed by %r' % (self.vcs, diff_chunk[:match.end()], rest[:1000])) difflines = imap(self._escaper, re.findall(r'.*\n|.+$', rest)) # don't split on \r as str.splitlines do return groups, difflines diff --git a/kallithea/tests/models/test_diff_parsers.py b/kallithea/tests/models/test_diff_parsers.py --- a/kallithea/tests/models/test_diff_parsers.py +++ b/kallithea/tests/models/test_diff_parsers.py @@ -276,7 +276,10 @@ class DiffLibTest(BaseTestCase): @parameterized.expand([(x,) for x in DIFF_FIXTURES]) def test_diff(self, diff_fixture): diff = fixture.load_resource(diff_fixture, strip=False) - diff_proc = DiffProcessor(diff) + vcs = 'hg' + if diff_fixture.startswith('git_'): + vcs = 'git' + diff_proc = DiffProcessor(diff, vcs=vcs) diff_proc_d = diff_proc.prepare() data = [(x['filename'], x['operation'], x['stats']) for x in diff_proc_d] expected_data = DIFF_FIXTURES[diff_fixture]