69aeaaaf6e07: store: simplify class hierarchy

Matt Mackall mpm at selenic.com
Thu Aug 14 11:15:11 CDT 2008


On Thu, 2008-08-14 at 15:38 +0200, Adrian Buehlmann wrote:
> For example, this creates a new attribute "createmode" on the function
> http://hg.intevation.org/mercurial/crew/file/438e02b4be73/mercurial/statichttprepo.py#l28

It's in fact createmode that's the problem. Opener originally had a
single function-like interface (back when statichttprepo was created)
and has since grown a few warts.

> Feels like a layering violation, since we now have again the opener
> provided as a parameter.

No, that's the way it ought to work, it's just that opener is less than
perfect. Revlog shouldn't know about file access (so that we can access
files in different ways) and filelog shouldn't know about paths (so we
can change the layout). Similarly, store shouldn't care whether
something is local or across http or sftp or sitting in a database or
whatever. Store should just deal with naming and it should do that by
wrapping openers.

> If we have to deal again with unknown opener types, _calcmode() and setting
> the createmode of (in fact, util.opener) probably should be moved back out of store.py
> then.

Probably. We might for instance want a storeopener subclass in localrepo
that deals with modes internally. 

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list