[PATCH] Pure python base85 fallback

Dennis Brakhane brakhane at googlemail.com
Tue Dec 30 02:49:36 CST 2008


Two minor suggestions:

On Tue, Dec 30, 2008 at 4:30 AM, Brendan Cully <brendan at kublai.com> wrote:
> diff --git a/mercurial/fallbacks/base85.py b/mercurial/fallbacks/base85.py
> [...]
> +        for i in range(4, -1, -1):
> +            rems[i] = _b85chars[word % 85]
> +            word /= 85
Better make this word //= 85, one thing less to modify when trying to
get hg work with Python 3. Or does hg have to support Python 2.1?

> words = struct.unpack('>' + 'L' * longs, text[0:longs*4])

I'd think unpack('>%iL' % longs, text[0:longs*4]) would be slightly
better here, as no long string has to be created and parsed (the same
goes for pack)

BTW, Matt said that all C code was once implemented in Python, so
there probably is some base85 encoding.


More information about the Mercurial-devel mailing list