[PATCH] largefiles: Use sha1sum.py since OS X has generic shasum utility

Na'Tosha Bard natosha at unity3d.com
Wed Oct 26 04:46:35 CDT 2011


2011/10/25 Matt Mackall <mpm at selenic.com>

> On Mon, 2011-10-24 at 20:35 -0400, Greg Ward wrote:
> > 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
> > > +
> > > +try:
> > > +    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
>
> As far as I'm aware, we only need one hash function for tests and it
> needn't be cryptographically strong. I'll change the largefiles test to
> use the existing md5sum.py.
>

Is there really a good reason to do this?  This means (as far as I can tell)
that suddenly kbfiles users are now going to have to convert their entire
repositories to be able to use largefiles.

Cheers,
Na'Tosha

-- 
*Na'Tosha Bard*
Build & Infrastructure Developer | Unity Technologies

*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20111026/3e3fbb1f/attachment.html>


More information about the Mercurial-devel mailing list