[PATCH] largefiles: Use sha1sum.py since OS X has generic shasum utility
greg-hg at gerg.ca
Mon Oct 24 19:35:10 CDT 2011
On Mon, Oct 24, 2011 at 2:15 PM, Lee Cantey <lcantey at gmail.com> wrote:
> # HG changeset patch
> # User Lee Cantey <lcantey at gmail.com>
> # Date 1319479837 25200
> # Branch stable
> # Node ID 17323a5ee76870b1b48e7308511c34c98825f35a
> # Parent 8b8dd13295dbd733cc03ebb3c2af2f33d24d5428
> largefiles: Use sha1sum.py since OS X has generic shasum utility.
> diff -r 8b8dd13295db -r 17323a5ee768 tests/sha1sum.py
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/tests/sha1sum.py Mon Oct 24 11:10:37 2011 -0700
> @@ -0,0 +1,42 @@
> +#!/usr/bin/env python
> +# Based on python's Tools/scripts/md5sum.py
> +# This software may be used and distributed according to the terms
> +# of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is
> +# GPL-compatible.
> +import sys, os
> + from hashlib import sha1
> +except ImportError:
> + from sha import sha as sha1
It looks like you just photocopied tests/md5sum.py and called it
tests/sha1sum.py. It would be ever so much nicer to refactor, e.g.
* rename md5sum.py to hash.py
* make it take two args, hash algorithm and filename
* update existing callers in tests/
* make test-largefiles.t use it
Obviously the first three steps have to be a single changeset. And
there's more than one way to do it; that's just the first thing that
popped into my head.
> Also switch to from echo -n to printf
Should be a separate changeset -- that's completely uncontroversial
and should go right in (IMHO).
More information about the Mercurial-devel