bug in commands.py:revert()?

Bryan O'Sullivan bos at serpentine.com
Thu Sep 1 12:13:43 CDT 2005


On Thu, 2005-09-01 at 13:07 -0400, Dan Christensen wrote:

>     def trimpath(p):
>         p = os.path.realpath(p)
>         if p.startswith(root):
>             rest = p[len(root):]
>             if not rest:
>                 return rest
>             if p.startswith(os.sep):
> *               return rest[1:]
>             return p
> 
> The marked line doesn't look right, since the only way to get there is
> if rest == '', in which case rest[1:] is a strange thing to do (it 
> just returns the empty string again).  

No, the only way to get there is if rest is *not* ''.

> Moreover, I think realpath always returns an absolute path, so
> the condition "if p.startwith(os.sep)" should always be true.

That appears to be true.

	<b



More information about the Mercurial mailing list