[PATCH 1 of 5 STABLE] filecache: pass func name that constructs the full path of the given file

Idan Kamara idankk86 at gmail.com
Wed Feb 29 02:54:40 CST 2012


On Wed, Feb 29, 2012 at 2:20 AM, Matt Mackall <mpm at selenic.com> wrote:

> On Wed, 2012-02-29 at 01:40 +0200, Idan Kamara wrote:
> > On Wed, Feb 29, 2012 at 12:59 AM, Matt Mackall <mpm at selenic.com> wrote:
>
> > > Making this work cleanly is a simple matter of localizing the
> > > path-joining logic to a single method that the derived class overrides:
> > >
> > > class storecache(scmutil.filecache):
> > >    def join(self, obj, fname):
> > >        return obj.sjoin(fname)
> >
> >
> > I guess that's better, except it forces all clients of such classes
> > to name their join function the same.
>
> No, because this entire class is now specifically tailored for caching
> store files for localrepo methods (note the 'sjoin'). The class is
> tailored to the client, the client just needs to use the appropriate
> class.


localrepo and dirstate both need a cache for repo files, so now we have
two 'repocache' classes, one for localrepo's 'join' and another that uses
whatever dirstate calls its repo-relative join function?

Unless I misunderstand what you mean here, I don't see how this is
less yucky than my original suggestion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120229/2f3a2c31/attachment.html>


More information about the Mercurial-devel mailing list