[PATCH] Fix for Issue1260
Matt Mackall
mpm at selenic.com
Fri Aug 15 14:31:00 CDT 2008
On Fri, 2008-08-15 at 15:53 +0100, Frank Kingswood wrote:
> Adrian Buehlmann wrote:
> > # HG changeset patch
> > # User Adrian Buehlmann <adrian at cadifra.com>
> > # Date 1218803955 -7200
> > # Node ID fcb89cadd5530f8d680b8bca9235d5bc9f3f4fd5
> > # Parent 438e02b4be73ffd80d4a6cc45b7c9273d6b26604
> > Fix for Issue1260
> >
> > diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
> > --- a/mercurial/statichttprepo.py
> > +++ b/mercurial/statichttprepo.py
> > @@ -24,7 +24,7 @@
> >
> > def opener(base):
> > """return a function that opens files over http"""
> > - p = base
> > + p = base.replace('\\', '/')
> > def o(path, mode="r"):
> > f = "/".join((p, urllib.quote(path)))
> > return rangereader(f)
>
> This seems the wrong place to handle this. Shouldn't the callers be
> fixed instead, so that statichttprepo gets valid URLs?
Let's back up and look at the big picture:
A repo object uses a store object to figure out where its files are. A
store object uses an opener object to open those files. The typical
opener object takes local paths.
Now a statichttprepo looks just like a localrepo but with one
difference: it's accessed via http. We use a special opener to open our
files. So at some point we do something like this in store:
os.path.join(path, "store")
Which is a perfectly reasonable thing to do, as openers generally take
local paths. But path here ends up being our http URL.
So we can either fix it here with a small hack or rethink the way
openers and paths work.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list