[MERGE] Micro-tweaks to sha routines.
Andrew Bennetts
andrew at canonical.com
Mon Sep 17 08:39:26 BST 2007
Robert Collins wrote:
> This just tweaks the sha helpers in osutils to make less calls - they
> are often called from inner loops.
bb:tweak
> -def sha_strings(strings):
> +def sha_strings(strings, factory=sha.new):
> """Return the sha-1 of concatenation of strings"""
> - s = sha.new()
> + s = factory()
> map(s.update, strings)
> return s.hexdigest()
Please rename 'factory' to '_factory'. It's an optimisation hack, not an
argument that callers should use.
Otherwise this all looks sensible to me.
-Andrew.
More information about the bazaar
mailing list