Show More
@@ -60,6 +60,7 b' class ChangesetController(BaseRepoContro' | |||
|
60 | 60 | |
|
61 | 61 | def index(self, revision): |
|
62 | 62 | ignore_whitespace = request.GET.get('ignorews') == '1' |
|
63 | line_context = request.GET.get('context', 3) | |
|
63 | 64 | def wrap_to_table(str): |
|
64 | 65 | |
|
65 | 66 | return '''<table class="code-difftable"> |
@@ -131,7 +132,8 b' class ChangesetController(BaseRepoContro' | |||
|
131 | 132 | c.sum_added += node.size |
|
132 | 133 | if c.sum_added < self.cut_off_limit: |
|
133 | 134 | f_gitdiff = diffs.get_gitdiff(filenode_old, node, |
|
134 |
ignore_whitespace=ignore_whitespace |
|
|
135 | ignore_whitespace=ignore_whitespace, | |
|
136 | context=line_context) | |
|
135 | 137 | d = diffs.DiffProcessor(f_gitdiff, format='gitdiff') |
|
136 | 138 | |
|
137 | 139 | st = d.stat() |
@@ -170,7 +172,8 b' class ChangesetController(BaseRepoContro' | |||
|
170 | 172 | |
|
171 | 173 | if c.sum_removed < self.cut_off_limit: |
|
172 | 174 | f_gitdiff = diffs.get_gitdiff(filenode_old, node, |
|
173 |
ignore_whitespace=ignore_whitespace |
|
|
175 | ignore_whitespace=ignore_whitespace, | |
|
176 | context=line_context) | |
|
174 | 177 | d = diffs.DiffProcessor(f_gitdiff, |
|
175 | 178 | format='gitdiff') |
|
176 | 179 | st = d.stat() |
@@ -222,6 +225,7 b' class ChangesetController(BaseRepoContro' | |||
|
222 | 225 | |
|
223 | 226 | method = request.GET.get('diff', 'show') |
|
224 | 227 | ignore_whitespace = request.GET.get('ignorews') == '1' |
|
228 | line_context = request.GET.get('context', 3) | |
|
225 | 229 | try: |
|
226 | 230 | c.scm_type = c.rhodecode_repo.alias |
|
227 | 231 | c.changeset = c.rhodecode_repo.get_changeset(revision) |
@@ -241,7 +245,8 b' class ChangesetController(BaseRepoContro' | |||
|
241 | 245 | diff = _('binary file') + '\n' |
|
242 | 246 | else: |
|
243 | 247 | f_gitdiff = diffs.get_gitdiff(filenode_old, node, |
|
244 |
ignore_whitespace=ignore_whitespace |
|
|
248 | ignore_whitespace=ignore_whitespace, | |
|
249 | context=line_context) | |
|
245 | 250 | diff = diffs.DiffProcessor(f_gitdiff, |
|
246 | 251 | format='gitdiff').raw_diff() |
|
247 | 252 | |
@@ -255,7 +260,8 b' class ChangesetController(BaseRepoContro' | |||
|
255 | 260 | diff = _('binary file') |
|
256 | 261 | else: |
|
257 | 262 | f_gitdiff = diffs.get_gitdiff(filenode_old, node, |
|
258 |
ignore_whitespace=ignore_whitespace |
|
|
263 | ignore_whitespace=ignore_whitespace, | |
|
264 | context=line_context) | |
|
259 | 265 | diff = diffs.DiffProcessor(f_gitdiff, |
|
260 | 266 | format='gitdiff').raw_diff() |
|
261 | 267 |
@@ -406,6 +406,7 b' class FilesController(BaseRepoController' | |||
|
406 | 406 | 'repository.admin') |
|
407 | 407 | def diff(self, repo_name, f_path): |
|
408 | 408 | ignore_whitespace = request.GET.get('ignorews') == '1' |
|
409 | line_context = request.GET.get('context', 3) | |
|
409 | 410 | diff1 = request.GET.get('diff1') |
|
410 | 411 | diff2 = request.GET.get('diff2') |
|
411 | 412 | c.action = request.GET.get('diff') |
@@ -433,7 +434,8 b' class FilesController(BaseRepoController' | |||
|
433 | 434 | |
|
434 | 435 | if c.action == 'download': |
|
435 | 436 | _diff = diffs.get_gitdiff(node1, node2, |
|
436 |
|
|
|
437 | ignore_whitespace=ignore_whitespace, | |
|
438 | context=line_context) | |
|
437 | 439 | diff = diffs.DiffProcessor(_diff,format='gitdiff') |
|
438 | 440 | |
|
439 | 441 | diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
@@ -444,7 +446,8 b' class FilesController(BaseRepoController' | |||
|
444 | 446 | |
|
445 | 447 | elif c.action == 'raw': |
|
446 | 448 | _diff = diffs.get_gitdiff(node1, node2, |
|
447 |
|
|
|
449 | ignore_whitespace=ignore_whitespace, | |
|
450 | context=line_context) | |
|
448 | 451 | diff = diffs.DiffProcessor(_diff,format='gitdiff') |
|
449 | 452 | response.content_type = 'text/plain' |
|
450 | 453 | return diff.raw_diff() |
@@ -458,7 +461,8 b' class FilesController(BaseRepoController' | |||
|
458 | 461 | c.big_diff = True |
|
459 | 462 | else: |
|
460 | 463 | _diff = diffs.get_gitdiff(node1, node2, |
|
461 |
ignore_whitespace=ignore_whitespace |
|
|
464 | ignore_whitespace=ignore_whitespace, | |
|
465 | context=line_context) | |
|
462 | 466 | diff = diffs.DiffProcessor(_diff,format='gitdiff') |
|
463 | 467 | c.cur_diff = diff.as_html() |
|
464 | 468 | else: |
@@ -473,7 +477,8 b' class FilesController(BaseRepoController' | |||
|
473 | 477 | |
|
474 | 478 | else: |
|
475 | 479 | _diff = diffs.get_gitdiff(node1, node2, |
|
476 |
|
|
|
480 | ignore_whitespace=ignore_whitespace, | |
|
481 | context=line_context) | |
|
477 | 482 | diff = diffs.DiffProcessor(_diff,format='gitdiff') |
|
478 | 483 | c.cur_diff = diff.as_html() |
|
479 | 484 |
@@ -35,7 +35,7 b' from mercurial.match import match' | |||
|
35 | 35 | from vcs.exceptions import VCSError |
|
36 | 36 | from vcs.nodes import FileNode |
|
37 | 37 | |
|
38 | def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True): | |
|
38 | def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True, context=3): | |
|
39 | 39 | """ |
|
40 | 40 | Returns git style diff between given ``filenode_old`` and ``filenode_new``. |
|
41 | 41 | |
@@ -52,7 +52,7 b' def get_gitdiff(filenode_old, filenode_n' | |||
|
52 | 52 | |
|
53 | 53 | repo = filenode_new.changeset.repository |
|
54 | 54 | vcs_gitdiff = repo._get_diff(old_raw_id, new_raw_id, filenode_new.path, |
|
55 | ignore_whitespace) | |
|
55 | ignore_whitespace, context) | |
|
56 | 56 | |
|
57 | 57 | return vcs_gitdiff |
|
58 | 58 |
General Comments 0
You need to be logged in to leave comments.
Login now