[PATCH] expand paths to local repository or bundle in appropriate classes

Benoit Boissinot benoit.boissinot at ens-lyon.org
Mon Dec 14 02:50:43 CST 2009


On Mon, Dec 07, 2009 at 12:31:54PM +0200, Alexander Solovyov wrote:
> # HG changeset patch
> # User Alexander Solovyov <piranha at piranha.org.ua>
> # Date 1260181905 -7200
> # Node ID 4606d04e31d2f7737aff51460bccf9ea067d77e5
> # Parent  253d0da256b2b4becf68cc2c5a877e41e6a19abe
> expand paths to local repository or bundle in appropriate classes
> 
> This avoids problem with unexpanded paths when it's not possible to expand it at
> higher level (for example, if file:~/path/ is supplied as path in schemes).
> 
> diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py
> +++ b/mercurial/bundlerepo.py
> @@ -164,7 +164,7 @@ class bundlerepository(localrepo.localre
>              localrepo.localrepository.__init__(self, ui, self._tempparent)
>  
>          if path:
> -            self._url = 'bundle:' + path + '+' + bundlename
> +            self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
>          else:
>              self._url = 'bundle:' + bundlename
>  
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -15,8 +15,8 @@ import verify as _verify
>  import errno, os, shutil
>  
>  def _local(path):
> -    return (os.path.isfile(util.drop_scheme('file', path)) and
> -            bundlerepo or localrepo)
> +    path = util.expandpath(util.drop_scheme('file', path))
> +    return (os.path.isfile(path) and bundlerepo or localrepo)

Maybe be is should return the new path, and _lookup too. So the two
other changes wouldn't be needed.

What do you think?

Benoit

-- 
:wq


More information about the Mercurial-devel mailing list