[issue1260] faea0d27e38f breaks hg clone static-http on Windows
Adrian Buehlmann
mercurial-bugs at selenic.com
Thu Aug 14 08:58:53 UTC 2008
New submission from Adrian Buehlmann <adrian at cadifra.com>:
See http://www.selenic.com/hg/rev/faea0d27e38f
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1218676723 18000
> # Node ID faea0d27e38fb1a61ab35982d9d46c77b58b8680
> # Parent 40690d614ce603bba356b22c42f0491edda11c51
> statichttp: use store class
>
> This lets us nix store.encodefn.
>
> --- a/mercurial/statichttprepo.py Wed Aug 13 20:18:42 2008 -0500
> +++ b/mercurial/statichttprepo.py Wed Aug 13 20:18:43 2008 -0500
> @@ -54,14 +54,10 @@
> raise repo.RepoError(_("requirement '%s' not supported") % r)
>
> # setup store
> - if "store" in requirements:
> - self.spath = self.path + "/store"
> - else:
> - self.spath = self.path
> - self.encodefn = store.encodefn(requirements)
> - so = opener(self.spath)
> - self.sopener = lambda path, *args, **kw: so(
> - self.encodefn(path), *args, **kw)
> + self.store = store.store(requirements, self.path, opener)
This breaks "hg clone static-http:..." on Windows.
The erroneous result of this I've seen is that the resulting clone is empty
even if the source repo is non-empty. Unfortunately, there was no traceback
or error message, so the clone operation looked like it succeeded (it reports
"no changes found", which is wrong):
'''
> hgm clone static-http://kermit/repo1/
--- running hg from W:\hg-main
destination directory: repo1
no changes found
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
'''
This is probably because store.encodedstore:
'''
class encodedstore(_store):
def __init__(self, path, opener):
_store.__init__(self, os.path.join(path, 'store'))
'''
uses os.path.join, which on Windows forms an URL for the source
repo containing a *backslash*, which is probably not a valid URL
(e.g. 'http://example.com/repo1/.hg\store').
> + self.spath = self.store.path
> + self.sopener = self.store.opener
> + self.sjoin = self.store.join
Same problem here:
'''
def join(self, f):
return os.path.join(self.path, self.encodefn(f))
'''
>
> self.manifest = manifest.manifest(self.sopener)
> self.changelog = changelog.changelog(self.sopener)
> --- a/mercurial/store.py Wed Aug 13 20:18:42 2008 -0500
> +++ b/mercurial/store.py Wed Aug 13 20:18:43 2008 -0500
> @@ -119,12 +119,6 @@
> def join(self, f):
> return os.path.join(self.path, self.encodefn(f))
>
> -def encodefn(requirements):
> - if 'store' not in requirements:
> - return lambda x: x
> - else:
> - return encodefilename
> -
> def store(requirements, path, opener):
> if 'store' not in requirements:
> return directstore(path, opener)
----------
messages: 6767
nosy: abuehl, mpm
priority: bug
status: unread
title: faea0d27e38f breaks hg clone static-http on Windows
____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1260>
____________________________________________________
More information about the Mercurial-devel
mailing list