fix UnboundLocalError, refactor a bit
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Thu, 11 Oct 2007 12:16:55 +0200
changeset 5453 9d77f2b47eb7
parent 5452 82b4ff3abbcd
child 5454 f2ca8d2c988f
fix UnboundLocalError, refactor a bit bin wasn't defined in all branches (bug introduced in 82b4ff3abbcd
mercurial/revlog.py
--- a/mercurial/revlog.py	Thu Oct 11 00:46:56 2007 -0500
+++ b/mercurial/revlog.py	Thu Oct 11 12:16:55 2007 +0200
@@ -62,10 +62,9 @@
     if not text:
         return ("", text)
     l = len(text)
+    bin = None
     if l < 44:
-        if text[0] == '\0':
-            return ("", text)
-        return ('u', text)
+        pass
     elif l > 1000000:
         # zlib makes an internal copy, thus doubling memory usage for
         # large files, so lets do this in pieces
@@ -81,7 +80,7 @@
             bin = "".join(p)
     else:
         bin = _compress(text)
-    if len(bin) > l:
+    if bin is None or len(bin) > l:
         if text[0] == '\0':
             return ("", text)
         return ('u', text)