[PATCH 1 of 3] extensions: introduce a class interposition function

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Sun Nov 25 09:10:30 CST 2012


At Wed, 21 Nov 2012 10:29:19 +0100,
Pierre-Yves David wrote:
> 
> [1  <multipart/signed (7bit)>]
> [1.1  <text/plain; us-ascii (quoted-printable)>]
> On Tue, Nov 20, 2012 at 02:55:43PM -0800, Bryan O'Sullivan wrote:
> > # HG changeset patch
> > # User Bryan O'Sullivan <bryano at fb.com>
> > # Date 1353452136 28800
> > # Node ID cbf274dc847b5c28a282ae98a7d8b9bd48b6137d
> > # Parent  4ae21a7568f353dcb781df28d2acf458b06afcad
> > extensions: introduce a class interposition function
> > 
> > This allows an existing class to be augmented in a transparent way,
> > without its subclasses or callers needing to participate.
> > 
> > The manual class override mechanism currently in use introduces
> > names into an outer scope that can be accidentally (and incorrectly)
> > used in monkeypatched classes. It also does not make clear which
> > class is intended to be monkeypatched. Finally, it requires explicit
> > support from the to-be-monkeypatched code (e.g. reposetup).
> 
> I'm a afraid this will result in side effect when multiple repository are
> involved. FUJIWARA Katsunori spend a lot of time ensuring that enabling and
> extension in one repo won't affect other repository involved in the same
> process.
> 
> (But cleaning up the wrapping is a good idea)

I think Bryan's work will make extensions enabled in repositories not
enabling them, as Pierre mentioned.

Problem cases are:

  - clone from or push to localhost: extensions enabled only in the
    source are enabled also in the destination

  - pull from localhost: extensions enabled only in the destination
    are enabled also in the source

  - recursive execution in subrepo tree: extensions enabled only in
    the parent or some of siblings in the tree are enabled also in
    others

My last posted patches for this problem are:

    http://www.selenic.com/pipermail/mercurial-devel/2012-October/045434.html
    http://www.selenic.com/pipermail/mercurial-devel/2012-October/045435.html
    http://www.selenic.com/pipermail/mercurial-devel/2012-October/045436.html

Something to enable overriding/patching per repository class causes
this problem. Are there any good ways to enable overriding/patching
per repository instance ?

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list