[PATCH 1 of 3] pathauditor: add isvalidpath() method

Durham Goode durham at fb.com
Sun Feb 10 05:56:39 CST 2013


>> # HG changeset patch
>> # User Durham Goode <durham at fb.com>
>> # Date 1360103054 28800
>> # Node ID f2a1cf2cbb4ac88f922c5bcb5792c2c7c4c236d5
>> # Parent  c6377e34cb1ed79cb142f01652b0acfa09ef8c1f
>> pathauditor: add isvalidpath() method
>> 
>> The pathauditor currently throws exceptions when it encounters an
>>invalid
>> path. This change adds a method to allow people to treat it as a
>>boolean.
>> This is currently used by scmutil.addremove and in a subsequent patch it
>> will be used by dirstate.walk
>
>Can we name this check()?

I'll rename it.

>Does it make sense to invert things so that the check is done in check()
>and __call__() calls check() and raises an exception on failure?

I don't think it makes sense in this case.  __call__() throws different
exceptions based on how it fails, so making the algorithm return
True/False and throwing a single kind of exception would give less
information.



More information about the Mercurial-devel mailing list