[PATCH 6 of 6] commands: use dirstateguard instead of begin/end-parentchange for backout

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Oct 9 13:39:39 CDT 2015


At Fri, 09 Oct 2015 05:29:17 -0700,
Pierre-Yves David wrote:
> 
> 
> 
> On 10/08/2015 11:59 AM, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1444330427 -32400
> > #      Fri Oct 09 03:53:47 2015 +0900
> > # Node ID e3faacb44a12089395756401d91b45fe67436c44
> > # Parent  f4ff0385ec32d5192ce67fc6228ec87333335b14
> > commands: use dirstateguard instead of begin/end-parentchange for backout
> 
> Pushed to the clowncopter thanks.
> 
> Do you think it would be possible to setup a devel-warning for any 
> dirstate changes that happen outside a transaction or a dirstateguard range?

What about the way below ?

  1. introduce a kind of the stack into dirstate

     for example, in constructor of dirstate:

         self._guards = []

  2. push "scope id" into the above stack at starting scope of
     dirstateguard or transaction

     for example, at starting a transaction in localrepo:

         dirstate._guards.append('transaction.%s' % (id(tr)))

  3. examine whether this stack is empty or not at changing dirstate
     and show develwarning

     Adding examination straightforward to functions making dirstate
     dirty seems to have some performance impact, doesn't it ? (or is
     it cheeper enough than maybe preceding file I/O ?)

     If it is reasonable to assume that 'devel' configurations in
     'dirstate.ui' are kept during its lifetime, how about wrapping
     functions above by checker decorator at construction time ?

BTW, would you suppose enclosing code block like
'merge.recordupdates()' by dirstateguard or so ?

> -- 
> Pierre-Yves David
> 

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


More information about the Mercurial-devel mailing list