[MERGE] make sha1_provider a parameter to DirState()
Ian Clatworthy
ian.clatworthy at internode.on.net
Fri Mar 13 08:03:01 GMT 2009
Martin Pool wrote:
> I'd like to see at least one test that it actually uses a passed-in
> provider. It's obvious by inspection here of course that you're doing
> it but it would be good to guard against future breakage.
>
> For instance you could pass in a provider that's hardcoded to return the
> hash of the uppercase version of the file, which would be kind of
> analogous to content filtering but still let you test this in isolation.
> Then you could change the file and check that the stat and hash have
> changed.
With lots of help from John, this is now done.
> - def __init__(self, path):
> + def __init__(self, path, sha1_provider=None):
> """Create a DirState object.
>
> :param path: The path at which the dirstate file on disk should
> live.
> + :param sha1_provider: an object meeting the Sha1Provider
> interface.
> + If None, a DefaultSha1Provider is used.
>
>
> (comment) Since it's an internal interface I would have thought about
> not providing the default; we sometimes do this at multiple levels and
> it just creates cruft...
Done. This was definitely worth doing as it exposed some other entry
points (initialize(), from_tree()) that needed to support a sha1_provider
parameter.
New patch attached. The tweaks were large enough that I'm resubmitting
this rather than just land it.
Ian C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dirstate-sha1-provider-2.patch
Type: text/x-diff
Size: 26395 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090313/f8e7ea60/attachment.bin
More information about the bazaar
mailing list