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