How should dirstate.invalidate() interact with commands.debugstate(...) ?

Peer Stritzinger peerst at gmail.com
Tue Oct 25 12:15:09 CDT 2011


While trying to debug a issue in "hg collapse" that seems to be
pointing to some error how the dirstate is treated
I'm playing with debugstate and dirstate.invalidate to find out what's going on.

However it looks like repo.dirstate.invalidate() doesn't do anything
from the view of command debugstate.
The code:

            # all this is in a loop that
            # starts some dirstate.setparents
            ...
            repo.dirstate.write()

            ui.debug(_('debugstate:\n'))            # here starts the
code that behaves funny
            commands.debugstate(ui, repo)

            ui.debug(_('repo.dirstate.invalidate()\n'))
            repo.dirstate.invalidate()

            ui.debug(_('debugstate:\n'))
            commands.debugstate(ui, repo)

            ui.debug(_('reverting to revision %d\n') % r)
            recreaterev(ui, repo, r)                # in here is a
call to command.revert()

            # followed by commit

Gives output like this:

    debugstate:
    n 644          2 2011-10-25 16:27:46 a
    n 644          2 2011-10-25 16:27:46 b
    n 644          2 2011-10-25 16:27:46 c
    n 644          2 2011-10-25 16:27:46 d
    n 644          2 2011-10-25 16:27:49 e
    n 644          2 2011-10-25 16:27:51 f
    n   0         -1 unset               n
    repo.dirstate.invalidate()
    debugstate:
    n 644          2 2011-10-25 16:27:46 a
    n 644          2 2011-10-25 16:27:46 b
    n 644          2 2011-10-25 16:27:46 c
    n 644          2 2011-10-25 16:27:46 d
    n 644          2 2011-10-25 16:27:49 e
    n 644          2 2011-10-25 16:27:51 f
    n   0         -1 unset               n

When I look at the code of debugstate and dirstate.invalidate I would
expect the debugstate after the invalidate to be empty.  However it
isn't.

How can this be?

Cheers
--Peer


More information about the Mercurial-devel mailing list