[PATCH] hg: copy buffer state to remote ui

Elmar Bartel elmar at leo.org
Thu Jun 11 16:40:01 UTC 2020


Hello Yuya,

> > +    # copy buffer state to the remote ui
> > +    if src._buffers:
> > +        dst._buffers = src._buffers
> > +        dst._bufferstates = src._bufferstates
> > +        dst._bufferapplylabels = src._bufferstates[-1][2]
> 
> The state would become inconsistent if you do popbuffer() later on.
Which state: the state of the original ui or the state of
the remote-ui?
Anyway, as long as the ui-buffer interface is correctly used 
(properly matching pushpuffer() and popbuffer()) I cannot
see any state becoming inconsistent.
Furthermore the remote-ui is not accessible from the user
calling pushbuffer() on the original ui. This fact brought
me to the solution which my patch implements.

> [...]
> And this touches the internal of the ui, we'll need some tests so
> the change wouldn't regress.
Is see two things here, which could be tested:
  - the original ui is not changed, beside the desired effect of
    having additional content in the buffer.
  - the buffer does contain the content from the actions on the
    remoute-ui
Is this the test you suggest?

> It might be even better to add a function to copy ui with
> buffer e.g. ui.copy_sharing_buffer() or ui.copy(share_buffer=True).
I completly agree here.
This is the place where copying things should happen.
And then, remoteui() would just call ui.copy(share_buffer=True).

Nevertheless: the problems you anticipate (and I do not yet see)
are then moved to the ui.copy() function. Since what can really
be done by ui.copy(share_buffer==True)?
I see two posibilities:

 1) ui.copy(share_buffer==True) merely does the same, as my patch.
 2) or, deep-copy the buffer structure to the destination ui.
    
With 1) we'd run into the problems you anticipate.
With 2) the problem arises when/where to copy back the buffered
content to the buffers of the original ui. 

Sorry for the many questions.

Yours,
Elmar.
-- 
LEO GmbH          | Elmar Bartel                 | 
Mühlweg 2b        | Phone: +49 (0)8104-90950141  | No signature here.
D-82054 Sauerlach | Fax:   +49 (0)8104-90950290  |
Germany           | Email: elmar at leo.org         |

Register Gericht: Amtsgericht München, HRB161107
Geschäftsführer:  Hans Riethmayer, Elmar Bartel



More information about the Mercurial-devel mailing list