[PATCH] remove unused spath instance variable from localrepo and statichttprepo

Martin Geisler mg at lazybytes.net
Sun Sep 20 05:12:35 CDT 2009


Andrey Somov <py4fun at gmail.com> writes:

> It leads me to another question: is there a way to detect whether the
> code is unused ?

It's mostly a judgement call. If you can see that a chunk of code is no
longer being called anywhere in Mercurial, then it can probably be
removed.

I'm a bit unsure about those spath instance variables -- it looks a bit
like they are meant to form an API for repository classes. But since
they are not used by Mercurial itself and since we have not yet fixed a
public API, then we might want to clean them up anyway.

> For instance I have found an 'if' statement with a complex expression.
> I think a part of the condition is never met. Of course removing this
> check will not significantly improve performance but it is more
> difficult to read the code.
>
> (As far as I understand tests do not provide any guarantee.)

Right, in general, the tests can only prove that a piece of code *is*
used, not the opposite. But that is only for the general case. If you
have a specific if-statement, then it's often possible to show that this
or that condition are redundant. It all depends on the specific code.

So please point out the if-statement in question.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090920/3958cb03/attachment.pgp 


More information about the Mercurial-devel mailing list