[PATCH 1 of 3] dirstate: don't check state of subrepo directories

Matt Mackall mpm at selenic.com
Thu Dec 31 15:15:26 CST 2009


On Thu, 2009-12-31 at 14:36 -0600, durin42 at gmail.com wrote:
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1261857501 21600
> # Node ID 68d80c9814d720f2b7d8b2f39008ae6547a5b128
> # Parent  513c89a60f203a8387d8dfa6f2dc67b21725790a
> dirstate: don't check state of subrepo directories

> -    def status(self, match, ignored, clean, unknown):
> +    def status(self, match, ignored, clean, unknown, skip=[]):

When do we ever not want to skip subrepos? And why not call this arg
subrepos so we don't abuse it for something else?

> -            s = self.dirstate.status(match, listignored, listclean, listunknown)
> +            s = self.dirstate.status(match, listignored, listclean, listunknown,
> +                                     skip=set(ctx1.substate.keys() +
> +                                              ctx2.substate.keys()))

Why are we passing both contexts' substate info down? The only one that
is relevant to status in the working directory is the workingctx, yes?
And I think that's always ctx2:

        working = ctx2.rev() is None

Backing up a bit, it'd be nice to wire this up when we create the
dirstate object:

    @propertycache
    def dirstate(self):
        return dirstate.dirstate(self.opener, self.ui, self.root,
skiplist)

Then status/walk callers never have to think/know about subrepos, which
is nice. Maybe there aren't enough callers to matter?

But this implies reading .hgsub (possibly unnecessarily) at create time.
Which we don't really want to do. Nor do we want dirstate to hold a
reference to localrepo, so passing in a callback tricky.

Alternately, we could teach dirstate internally about parsing .hgsub
files similar to how it already knows about .hgignore files.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list