Mercurial > kallithea
changeset 1043:6ec53c16c744 beta
fixed binary file issues
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 14 Feb 2011 15:29:53 +0100 |
parents | ab0a2b69d082 |
children | f3402cb92fdf |
files | rhodecode/controllers/files.py rhodecode/templates/files/files_annotate.html rhodecode/templates/files/files_source.html |
diffstat | 3 files changed, 24 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/files.py Mon Feb 14 15:16:45 2011 +0100 +++ b/rhodecode/controllers/files.py Mon Feb 14 15:29:53 2011 +0100 @@ -224,12 +224,16 @@ elif c.action == 'diff': if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: c.cur_diff = _('Diff is to big to display') + elif node1.is_binary or node2.is_binary: + c.cur_diff = _('Binary file') else: c.cur_diff = diff.as_html() else: #default option if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: c.cur_diff = _('Diff is to big to display') + elif node1.is_binary or node2.is_binary: + c.cur_diff = _('Binary file') else: c.cur_diff = diff.as_html()
--- a/rhodecode/templates/files/files_annotate.html Mon Feb 14 15:16:45 2011 +0100 +++ b/rhodecode/templates/files/files_annotate.html Mon Feb 14 15:29:53 2011 +0100 @@ -63,24 +63,28 @@ <div class="commit">"${c.file.message}"</div> </div> <div class="code-body"> + %if c.file.is_binary: + ${_('Binary file')} + %else: % if c.file.size < c.cut_off_limit: ${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} %else: ${_('File is to big to display')} ${h.link_to(_('show as raw'), h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path))} - %endif + %endif + <script type="text/javascript"> + YAHOO.util.Event.onDOMReady(function(){ + YAHOO.util.Event.addListener('show_rev','click',function(e){ + YAHOO.util.Event.preventDefault(e); + var cs = YAHOO.util.Dom.get('diff1').value; + var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); + window.location = url; + }); + }); + </script> + %endif </div> </div> - <script type="text/javascript"> - YAHOO.util.Event.onDOMReady(function(){ - YAHOO.util.Event.addListener('show_rev','click',function(e){ - YAHOO.util.Event.preventDefault(e); - var cs = YAHOO.util.Dom.get('diff1').value; - var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); - window.location = url; - }); - }); - </script> </div> </div> </div>
--- a/rhodecode/templates/files/files_source.html Mon Feb 14 15:16:45 2011 +0100 +++ b/rhodecode/templates/files/files_source.html Mon Feb 14 15:29:53 2011 +0100 @@ -36,6 +36,9 @@ <div class="commit">"${c.files_list.last_changeset.message}"</div> </div> <div class="code-body"> + %if c.files_list.is_binary: + ${_('Binary file')} + %else: % if c.files_list.size < c.cut_off_limit: ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} %else: @@ -71,7 +74,8 @@ } highlight_lines(h_lines); } - </script> + </script> + %endif </div> </div>