[PATCH] journal: use a more compatible way to wrap dirstate

Yuya Nishihara yuya at tcha.org
Sat May 27 09:55:57 EDT 2017


On Fri, 26 May 2017 19:51:09 -0700, Jun Wu wrote:
> This fixes the test with fsmonitor but is not 100% correct. The dirstate
> state will be lost when dirstate object is reconstructed.

Yes, and that would be more likely to be happen on Windows where filecache
isn't cacheable.

> That said, I think the journal extension is not doing the most correct
> things.  I think recording journal should be transaction aware. Ideally
> journal runs at the end of transaction, instead of wrapping
> non-transactional changes like what we have today.
> 
> If journal will eventually be refactored to run at the end of a transaction,
> I think this patch as a temporary fix might be fine.

I suppose marmoute's tr.changes will solve the issue.

> Excerpts from Jun Wu's message of 2017-05-25 19:56:41 -0700:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1495767385 25200
> > #      Thu May 25 19:56:25 2017 -0700
> > # Node ID 27b3fcbc4fd5125d86a4f4f2cb3e9accdae71265
> > # Parent  2b5953a49f1407f825d65b45986d213cb5c79203
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 27b3fcbc4fd5
> > journal: use a more compatible way to wrap dirstate
> > 
> > Previously journal uses
> > 
> >   extensions.wrapfunction(localrepo.localrepository.dirstate, 'func', wrap)
> > 
> > in extsetup to change dirstate. That assumes the dirstate filecache is not
> > touched by others, and is incompatible with bf3af0eced.

I don't think journal extension is guilty. Both fsmonitor and journal do weird
thing. Can't it be addressed if localrepository had a plain _dirstate() factory?

  @filecache
  def dirstate(self):
      return self._dirstate()  # override this by journalrepo and fsmonitorrepo


More information about the Mercurial-devel mailing list