changeset 1259:4209cd4b7823 beta

fixed problem with binary files, and for files that were deleted.
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 14 Apr 2011 10:52:12 +0200
parents 3954bdaf6243
children 83da8834f7b1
files rhodecode/controllers/changeset.py rhodecode/lib/helpers.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/changeset.py	Thu Apr 14 01:07:18 2011 +0200
+++ b/rhodecode/controllers/changeset.py	Thu Apr 14 10:52:12 2011 +0200
@@ -104,12 +104,14 @@
                 filenode_old = FileNode(node.path, '', EmptyChangeset())
                 if filenode_old.is_binary or node.is_binary:
                     diff = wrap_to_table(_('binary file'))
+                    st = (0, 0)
                 else:
                     c.sum_added += node.size
                     if c.sum_added < self.cut_off_limit:
                         f_gitdiff = differ.get_gitdiff(filenode_old, node)
                         d = differ.DiffProcessor(f_gitdiff, format='gitdiff')
                         diff = d.as_html()
+                        st = d.stat()
                     else:
                         diff = wrap_to_table(_('Changeset is to big and '
                                                'was cut off, see raw '
@@ -119,7 +121,6 @@
 
                 cs1 = None
                 cs2 = node.last_changeset.raw_id
-                st = d.stat()
                 c.lines_added += st[0]
                 c.lines_deleted += st[1]
                 c.changes[changeset.raw_id].append(('added', node, diff,
@@ -138,6 +139,7 @@
 
                     if filenode_old.is_binary or node.is_binary:
                         diff = wrap_to_table(_('binary file'))
+                        st = (0, 0)
                     else:
 
                         if c.sum_removed < self.cut_off_limit:
@@ -145,7 +147,7 @@
                             d = differ.DiffProcessor(f_gitdiff,
                                                      format='gitdiff')
                             diff = d.as_html()
-
+                            st = d.stat()
                             if diff:
                                 c.sum_removed += len(diff)
                         else:
@@ -157,7 +159,6 @@
 
                     cs1 = filenode_old.last_changeset.raw_id
                     cs2 = node.last_changeset.raw_id
-                    st = d.stat()
                     c.lines_added += st[0]
                     c.lines_deleted += st[1]
                     c.changes[changeset.raw_id].append(('changed', node, diff,
@@ -169,7 +170,7 @@
             if not c.cut_off:
                 for node in changeset.removed:
                     c.changes[changeset.raw_id].append(('removed', node, None,
-                                                        None, None, None))
+                                                        None, None, (0, 0)))
 
         if len(c.cs_ranges) == 1:
             c.changeset = c.cs_ranges[0]
--- a/rhodecode/lib/helpers.py	Thu Apr 14 01:07:18 2011 +0200
+++ b/rhodecode/lib/helpers.py	Thu Apr 14 10:52:12 2011 +0200
@@ -644,7 +644,6 @@
 
 def fancy_file_stats(stats):
     a, d, t = stats[0], stats[1], stats[0] + stats[1]
-    print stats
     width = 100
     unit = float(width) / (t or 1)