bug: repo at root of filesystem does not work correctly

Thomas Arendsen Hein thomas at intevation.de
Thu Nov 9 14:58:11 CST 2006


* Robert Shaw <rshaw at dpkg4x.org> [20061107 19:34]:
> --- a/mercurial/dirstate.py	Sat Oct 28 11:00:59 2006 +0200
> +++ b/mercurial/dirstate.py	Tue Nov 07 09:45:04 2006 -0800
> @@ -32,7 +32,11 @@ class dirstate(object):
>      def getcwd(self):
>          cwd = os.getcwd()
>          if cwd == self.root: return ''
> -        return cwd[len(self.root) + 1:]
> +        # self.root may end with a path separator when self.root == '/'
> +        common_prefix_len = len(self.root)
> +        if not self.root.endswith('/'):
> +            common_prefix_len += 1
> +        return cwd[common_prefix_len:]

I pushed this patch with '/' replaced with os.sep to crew.

That way it fixes the same problem on Windows, too.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list