Show More
@@ -65,8 +65,8 b' class FilesController(BaseController):' | |||
|
65 | 65 | hg_model = HgModel() |
|
66 | 66 | c.repo = hg_model.get_repo(c.repo_name) |
|
67 | 67 | file_node = c.repo.get_changeset(revision).get_node(f_path) |
|
68 |
response. |
|
|
69 |
response. |
|
|
68 | response.content_type = file_node.mimetype | |
|
69 | response.content_disposition = 'attachment; filename=%s' \ | |
|
70 | 70 | % f_path.split('/')[-1] |
|
71 | 71 | return file_node.content |
|
72 | 72 | |
@@ -77,6 +77,7 b' class FilesController(BaseController):' | |||
|
77 | 77 | hg_model = HgModel() |
|
78 | 78 | diff1 = request.GET.get('diff1') |
|
79 | 79 | diff2 = request.GET.get('diff2') |
|
80 | c.action = action = request.GET.get('diff') | |
|
80 | 81 | c.no_changes = diff1 == diff2 |
|
81 | 82 | c.f_path = f_path |
|
82 | 83 | c.repo = hg_model.get_repo(c.repo_name) |
@@ -85,11 +86,23 b' class FilesController(BaseController):' | |||
|
85 | 86 | |
|
86 | 87 | c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1._short) |
|
87 | 88 | c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2._short) |
|
88 | ||
|
89 | ||
|
90 | 89 | f_udiff = differ.get_udiff(c.changeset_1.get_node(f_path), |
|
91 | 90 | c.changeset_2.get_node(f_path)) |
|
92 | c.differ = differ.DiffProcessor(f_udiff) | |
|
91 | ||
|
92 | diff = differ.DiffProcessor(f_udiff) | |
|
93 | ||
|
94 | if action == 'download': | |
|
95 | diff_name = '%s_vs_%s.diff' % (diff1, diff2) | |
|
96 | response.content_type = 'text/plain' | |
|
97 | response.content_disposition = 'attachment; filename=%s' \ | |
|
98 | % diff_name | |
|
99 | return diff.raw_diff() | |
|
100 | ||
|
101 | elif action == 'raw': | |
|
102 | c.cur_diff = '<pre class="raw">%s</pre>' % diff.raw_diff() | |
|
103 | elif action == 'diff': | |
|
104 | c.cur_diff = diff.as_html() | |
|
105 | ||
|
93 | 106 | return render('files/file_diff.html') |
|
94 | 107 | |
|
95 | 108 | def _get_history(self, repo, node, f_path): |
@@ -14,13 +14,17 b' div.diffblock .code-header{' | |||
|
14 | 14 | color:blue; |
|
15 | 15 | padding:10px 0 10px 0; |
|
16 | 16 | } |
|
17 |
div.diffblock .code-header |
|
|
17 | div.diffblock .code-header div{ | |
|
18 | 18 | margin-left:25px; |
|
19 | 19 | font-weight: bold; |
|
20 | 20 | } |
|
21 | 21 | div.diffblock .code-body{ |
|
22 | 22 | background: #EEEEEE; |
|
23 | 23 | } |
|
24 | div.diffblock pre.raw{ | |
|
25 | background: #FFFFFF; | |
|
26 | color:#000000; | |
|
27 | } | |
|
24 | 28 | |
|
25 | 29 | .code-difftable{ |
|
26 | 30 | border-collapse: collapse; |
@@ -12,7 +12,9 b' a {' | |||
|
12 | 12 | a:HOVER{ |
|
13 | 13 | text-decoration: underline; |
|
14 | 14 | } |
|
15 |
/*** end of Initial Settings ***/ |
|
|
15 | /*** end of Initial Settings ***/ | |
|
16 | ||
|
17 | /** common settings **/ | |
|
16 | 18 | div#main { |
|
17 | 19 | padding: 5px; |
|
18 | 20 | } |
@@ -381,76 +383,97 b' p.files {' | |||
|
381 | 383 | /** end of file **/ |
|
382 | 384 | |
|
383 | 385 | /** changeset **/ |
|
384 | h3.changeset { | |
|
385 | margin: 20px 0 5px 20px; | |
|
386 | padding: 0 0 2px; | |
|
387 | font-size: 1.6em; | |
|
388 | border-bottom: dotted 1px #D5E1E6; | |
|
389 | } | |
|
390 | 386 | |
|
391 | p.changeset-age { | |
|
392 | position: relative; | |
|
387 | .cs_files{ | |
|
388 | border: 2px solid #CCCCCC; | |
|
389 | width: 60%; | |
|
390 | ||
|
393 | 391 | } |
|
394 | ||
|
395 | p.changeset-age span { | |
|
396 | position: absolute; | |
|
397 | top: -25px; | |
|
398 | right: 10px; | |
|
399 | font-size: 1.4em; | |
|
400 | color: #CCC; | |
|
401 | font-weight: bold; | |
|
402 | font-style: italic; | |
|
392 | .cs_files .cs_added{ | |
|
393 | background:#BBFFBB; | |
|
403 | 394 | } |
|
404 | ||
|
405 | p.description { | |
|
406 | margin: 10px 30px 0 30px; | |
|
407 | padding: 10px; | |
|
408 | border: solid 1px #CCC; | |
|
409 | font-size: 1.2em; | |
|
395 | .cs_files .cs_changed{ | |
|
396 | background: #FFDD88; | |
|
397 | } | |
|
398 | .cs_files .cs_removed{ | |
|
399 | background: #FF8888; | |
|
410 | 400 | } |
|
411 | 401 | |
|
412 | 402 | /** end of changeset **/ |
|
413 | 403 | |
|
414 | 404 | /** canvas **/ |
|
415 | div#wrapper { | |
|
416 | position: relative; | |
|
417 | font-size: 1.2em; | |
|
418 | } | |
|
419 | ||
|
420 | 405 | canvas { |
|
421 | 406 | position: absolute; |
|
422 | 407 | z-index: 5; |
|
423 | 408 | top: -0.7em; |
|
424 | 409 | } |
|
410 | #graph{ | |
|
411 | overflow: hidden; | |
|
425 | 412 | |
|
426 | ul#nodebgs li.parity0 { | |
|
427 | background: #F1F6F7; | |
|
413 | } | |
|
414 | #graph_nodes{ | |
|
415 | width:160px; | |
|
416 | float:left; | |
|
428 | 417 | } |
|
429 | 418 | |
|
430 | ul#nodebgs li.parity1 { | |
|
431 | background: #FFFFFF; | |
|
419 | #graph_content{ | |
|
420 | width:800px; | |
|
421 | float:left; | |
|
422 | } | |
|
423 | #graph_content .container_header{ | |
|
424 | border:1px solid #CCCCCC; | |
|
425 | height:30px; | |
|
426 | background: #EEEEEE; | |
|
427 | } | |
|
428 | ||
|
429 | ||
|
430 | #graph_content .container .wrapper{ | |
|
431 | width: 600px; | |
|
432 | } | |
|
433 | #graph_content .container{ | |
|
434 | border-bottom: 1px solid #CCCCCC; | |
|
435 | border-left: 1px solid #CCCCCC; | |
|
436 | border-right: 1px solid #CCCCCC; | |
|
437 | height:120px; | |
|
432 | 438 | } |
|
433 | 439 | |
|
434 | ul#graphnodes { | |
|
435 | position: absolute; | |
|
436 | z-index: 10; | |
|
437 | top: 7px; | |
|
438 | list-style: none inside none; | |
|
440 | #graph_content .container .left{ | |
|
441 | float:left; | |
|
442 | width: 70%; | |
|
443 | padding-left: 5px; | |
|
439 | 444 | } |
|
440 | 445 | |
|
441 | ul#nodebgs { | |
|
442 | list-style: none inside none; | |
|
446 | #graph_content .container .right{ | |
|
447 | float:right; | |
|
448 | width: 25%; | |
|
449 | } | |
|
450 | #graph_content .container .left .date{ | |
|
451 | font-weight:bold; | |
|
452 | } | |
|
453 | #graph_content .container .left .author{ | |
|
454 | ||
|
455 | } | |
|
456 | #graph_content .container .left .message{ | |
|
457 | font-size: 80%; | |
|
443 | 458 | } |
|
444 | 459 | |
|
445 | ul#graphnodes li,ul#nodebgs li { | |
|
446 | height: 39px; | |
|
460 | .right .added,.changed,.removed{ | |
|
461 | border:1px solid #DDDDDD; | |
|
462 | display:block; | |
|
463 | float:right; | |
|
464 | font-size:0.75em; | |
|
465 | text-align:center; | |
|
466 | min-width:15px; | |
|
447 | 467 | } |
|
448 | ||
|
449 | ul#graphnodes li .info { | |
|
450 | display: block; | |
|
451 | position: relative; | |
|
468 | .right .added{ | |
|
469 | background:#BBFFBB; | |
|
452 | 470 | } |
|
453 | ||
|
471 | .right .changed{ | |
|
472 | background: #FFDD88; | |
|
473 | } | |
|
474 | .right .removed{ | |
|
475 | background: #FF8888; | |
|
476 | } | |
|
454 | 477 | /** end of canvas **/ |
|
455 | 478 | |
|
456 | 479 | /* FILE BROWSER */ |
@@ -479,7 +502,8 b' div.browserblock .browser-body{' | |||
|
479 | 502 | } |
|
480 | 503 | |
|
481 | 504 | table.code-browser { |
|
482 |
border-collapse:collapse; |
|
|
505 | border-collapse:collapse; | |
|
506 | width: 100%; | |
|
483 | 507 | } |
|
484 | 508 | table.code-browser tr{ |
|
485 | 509 | margin:3px; |
@@ -491,6 +515,8 b' table.code-browser thead th {' | |||
|
491 | 515 | font-size: 1.1em; |
|
492 | 516 | font-weight: bold; |
|
493 | 517 | text-align: center; |
|
518 | text-align: left; | |
|
519 | padding-left: 10px; | |
|
494 | 520 | } |
|
495 | 521 | table.code-browser tbody tr { |
|
496 | 522 |
@@ -28,13 +28,22 b'' | |||
|
28 | 28 | <h2 class="no-link no-border">${'%s: %s %s %s' % (_('File diff'),c.diff2,'→',c.diff1)|n}</h2> |
|
29 | 29 | <div id="body" class="diffblock"> |
|
30 | 30 | <div class="code-header"> |
|
31 | <span>${h.link_to(c.f_path,h.url('files_home',repo_name=c.repo_name,revision=c.diff2.split(':')[1],f_path=c.f_path))}</span> | |
|
31 | <div> | |
|
32 | <span>${h.link_to(c.f_path,h.url('files_home',repo_name=c.repo_name, | |
|
33 | revision=c.diff2.split(':')[1],f_path=c.f_path))}</span> | |
|
34 | » <span style="font-size:77%">${h.link_to(_('diff'), | |
|
35 | h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='diff'))}</span> | |
|
36 | » <span style="font-size:77%">${h.link_to(_('raw diff'), | |
|
37 | h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='raw'))}</span> | |
|
38 | » <span style="font-size:77%">${h.link_to(_('download diff'), | |
|
39 | h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='download'))}</span> | |
|
40 | </div> | |
|
32 | 41 | </div> |
|
33 | 42 | <div class="code-body"> |
|
34 | 43 | %if c.no_changes: |
|
35 | 44 | ${_('No changes')} |
|
36 | 45 | %else: |
|
37 |
${c.diff |
|
|
46 | ${c.cur_diff|n} | |
|
38 | 47 | %endif |
|
39 | 48 | </div> |
|
40 | 49 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now