[PATCH 06 of 10] scmutil: make join cheaper

Patrick Mézard patrick at mezard.eu
Sat Sep 15 03:02:02 CDT 2012


Le 13/09/12 21:01, Bryan O'Sullivan a écrit :
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1347562630 25200
> # Node ID 38159ce2f0115498a0c43b4c84a3f9ba87d08561
> # Parent  d311c3d3c70fabe73f1053d238fc319ebdee20cb
> scmutil: make join cheaper
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -229,6 +229,7 @@
>          if expand:
>              base = os.path.realpath(util.expandpath(base))
>          self.base = base
> +        self.basesep = self.base + os.sep
>          self._setmustaudit(audit)
>          self.createmode = None
>          self._trustnlink = None
> @@ -331,9 +332,8 @@
>  
>      def join(self, path):
>          if path:
> -            return os.path.join(self.base, path)
> -        else:
> -            return self.base
> +            return path.startswith('/') and path or (self.basesep + path)
> +        return self.base
>  
>  class filteropener(abstractopener):
>      '''Wrapper opener for filtering filenames with a function.'''

This is incorrect on Windows and causes the test-contrib.t buildbot failure.

See this for details:

  http://hg.python.org/releasing/2.7.3/file/fe813f5711a5/Lib/ntpath.py#l73

--
Patrick Mézard



More information about the Mercurial-devel mailing list