[PATCH 1 of 2] localrepo: add afterpush()

Augie Fackler raf at durin42.com
Fri Jul 11 12:17:00 CDT 2014


On Wed, Jul 09, 2014 at 03:10:14PM -0500, Matt Mackall wrote:
> On Tue, 2014-07-08 at 03:03 -0700, Gregory Szorc wrote:
>
> > FWIW, this reasoning is why I'm a fan of grouping related functions in
> > classes over the traditional Mercurial "style" of module level
> > functions. With classes, I can go in with a scalpel and adjust
> > __class__ on a per instance basis. When that instance is destroyed,
> > the hacks die with it. Adjusting module symbols is juggling chainsaws
> > by comparison. There's too many considerations, especially in
> > persistent processes, such as hgweb and the command server. I'd prefer
> > we limit the surface area for bugs by encouraging instance specific
> > hacking over global/module hacking.
>
> That line of reasoning is all very good and I'd be inclined to agree
> with you if extensions were first-class citizens. But they're explicitly
> not: we intentionally sacrifice maintainability of modules for
> maintainability of the core. And the complexity of localrepo in
> particular has become a very obvious maintenance problem.
>
> However, if this is a big deal, perhaps the answer is a helper in
> extensions.py that calls your replacement function if the repo arg is of
> a particular class. This probably makes sense for both function and
> command wrappers.

hgsubversion has wrappers along these lines - perhaps those could be a
good guide for this extension hackery as well.

> Relatedly, lots of our monkeypatch setup work could probably be replaced
> with decorators.
>
>
> However, we can perhaps add a magic wrapper to extensions that does some
> sort of class matching on repo args for you.
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list