Show More
@@ -83,15 +83,19 b' class FilesController(BaseController):' | |||
|
83 | 83 | c.repo = hg_model.get_repo(c.repo_name) |
|
84 | 84 | c.changeset_1 = c.repo.get_changeset(diff1) |
|
85 | 85 | c.changeset_2 = c.repo.get_changeset(diff2) |
|
86 | ||
|
87 |
|
|
|
88 | c.file_2 = c.changeset_2.get_file_content(f_path) | |
|
86 | f1 = c.changeset_1.get_node(f_path) | |
|
87 | f2 = c.changeset_2.get_node(f_path) | |
|
88 | ||
|
89 | 89 | c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1._short) |
|
90 | 90 | c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2._short) |
|
91 | 91 | |
|
92 |
|
|
|
93 | c.diff_files = render_udiff(udiff=d2) | |
|
92 | f_udiff = unified_diff(f1.content.splitlines(True), | |
|
93 | f2.content.splitlines(True), | |
|
94 | f1.name, | |
|
95 | f2.name) | |
|
94 | 96 | |
|
97 | c.diff_files = render_udiff(udiff=f_udiff, differ='difflib') | |
|
98 | print c.diff_files | |
|
95 | 99 | if len(c.diff_files) < 1: |
|
96 | 100 | c.no_changes = True |
|
97 | 101 | return render('files/file_diff.html') |
@@ -40,11 +40,18 b' class DiffProcessor(object):' | |||
|
40 | 40 | """Extract the filename and revision hint from a line.""" |
|
41 | 41 | try: |
|
42 | 42 | if line1.startswith('--- ') and line2.startswith('+++ '): |
|
43 |
|
|
|
44 | new_rev = line2[4:].split(None, 1)[1] | |
|
45 | return filename, 'old', 'new' | |
|
43 | l1 = line1[4:].split(None, 1) | |
|
44 | old_filename = l1[0] if len(l1) >= 1 else None | |
|
45 | old_rev = l1[1] if len(l1) == 2 else 'old' | |
|
46 | ||
|
47 | l2 = line1[4:].split(None, 1) | |
|
48 | new_filename = l2[0] if len(l2) >= 1 else None | |
|
49 | new_rev = l2[1] if len(l2) == 2 else 'new' | |
|
50 | ||
|
51 | return old_filename, new_rev, old_rev | |
|
46 | 52 | except (ValueError, IndexError): |
|
47 | 53 | pass |
|
54 | ||
|
48 | 55 | return None, None, None |
|
49 | 56 | |
|
50 | 57 | def _highlight_line_difflib(self, line, next): |
@@ -39,11 +39,11 b'' | |||
|
39 | 39 | %for x in diff['chunks']: |
|
40 | 40 | %for y in x: |
|
41 | 41 | <tr class="line ${y['action']}"> |
|
42 | <td id="#${diff['filename']}_O${y['old_lineno']}" class="lineno old"> | |
|
43 | <pre><a href="#${diff['filename']}_O${y['old_lineno']}">${y['old_lineno']}</a></pre> | |
|
44 | </td> | |
|
42 | 45 | <td id="#${diff['filename']}_N${y['new_lineno']}"class="lineno new"> |
|
43 | 46 | <pre><a href="#${diff['filename']}_N${y['new_lineno']}">${y['new_lineno']}</a></pre> |
|
44 | </td> | |
|
45 | <td id="#${diff['filename']}_O${y['old_lineno']}" class="lineno old"> | |
|
46 | <pre><a href="#${diff['filename']}_O${y['old_lineno']}">${y['old_lineno']}</a></pre> | |
|
47 | 47 | </td> |
|
48 | 48 | <td class="code"> |
|
49 | 49 | <pre>${y['line']|n}</pre> |
General Comments 0
You need to be logged in to leave comments.
Login now