[patch 5/7] Automatic nesting into running transactions in the
mpm at selenic.com
Mon Aug 22 19:53:01 CDT 2005
On Mon, Aug 22, 2005 at 07:33:41PM -0400, Chris Mason wrote:
> On Mon, 22 Aug 2005 13:27:52 -0700
> Matt Mackall <mpm at selenic.com> wrote:
> > On Mon, Aug 22, 2005 at 01:44:39PM -0400, Chris Mason wrote:
> > > - return transaction.transaction(self.ui.warn, self.opener,
> > > + tr = transaction.transaction(self.ui.warn, self.opener,
> > > self.join("journal"), after)
> > > + # a weak reference is used to avoid a circular ref
> > > + self.transhandle = weakref.ref(tr)
> > > + return tr
> > I've made a great effort to avoid needing to use weakref elsewhere.
> > Can we promote the after function to module scope like opener and
> > thereby avoid this problem case too?
> When I relied 100% on after(), I ran into ordering problems between the
> dirstate and the transaction abort code. But I'll put some more
> thought into it, I didn't realize weakrefs were bad....
Well the badness is mostly that they break the refcounting model and
allow exceptions to appear in unexpected places.
> > If we must use weakref, I'd prefer to find a way such that it was
> > invisible to users of the transaction class, like using a wrapper.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial