# HG changeset patch # User Benoit Boissinot # Date 1192097815 -7200 # Node ID 9d77f2b47eb74b380e371e69df6a8de174e7b6f1 # Parent 82b4ff3abbcdfc75c74971512aa23e5f30ed89a5 fix UnboundLocalError, refactor a bit bin wasn't defined in all branches (bug introduced in 82b4ff3abbcd diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -62,10 +62,9 @@ def compress(text): 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 @@ def compress(text): 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)