changeset 5453:9d77f2b47eb7

fix UnboundLocalError, refactor a bit bin wasn't defined in all branches (bug introduced in 82b4ff3abbcd
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 11 Oct 2007 12:16:55 +0200
parents 82b4ff3abbcd
children f2ca8d2c988f
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)