changeset 2364:9d61aad859bc codereview

code garden
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 30 May 2012 23:12:24 +0200
parents 745dda7817ed
children 91fae60bf2b6
files rhodecode/lib/diffs.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/diffs.py	Wed May 30 23:12:16 2012 +0200
+++ b/rhodecode/lib/diffs.py	Wed May 30 23:12:24 2012 +0200
@@ -573,7 +573,8 @@
     :type other_ref:
     """
 
-    bundlerepo = ignore_whitespace = False
+    bundlerepo = None
+    ignore_whitespace = False
     context = 3
     org_repo = org_repo.scm_instance._repo
     other_repo = other_repo.scm_instance._repo
@@ -598,18 +599,20 @@
 
             buf = io.BytesIO()
             while True:
-                chunk = unbundle._stream.read(1024*4)
+                chunk = unbundle._stream.read(1024 * 4)
                 if not chunk:
                     break
                 buf.write(chunk)
 
             buf.seek(0)
+            # replace chunked _stream with data that can do tell() and seek()
             unbundle._stream = buf
 
             ui = make_ui('db')
             bundlerepo = InMemoryBundleRepo(ui, path=org_repo.root,
                                             bundlestream=unbundle)
-        return ''.join(patch.diff(bundlerepo or org_repo, node2=other_ref, opts=opts))
+        return ''.join(patch.diff(bundlerepo or org_repo, node2=other_ref,
+                                  opts=opts))
     else:
         return ''.join(patch.diff(org_repo, node1=org_ref, node2=other_ref,
                                   opts=opts))