hg status not showing empty dirs out of dirstate

Andrea Arcangeli andrea at suse.de
Fri Jun 16 01:00:23 CDT 2006


Hello,

On Thu, Jun 15, 2006 at 10:05:29PM -0700, Bryan O'Sullivan wrote:
> On Tue, 2006-06-06 at 06:35 +0200, Andrea Arcangeli wrote:
> 
> >  So I'd prefer to change hg
> > status to show dirs by default (optionally would be ok too, but there's
> > no option to do that at the moment).
> 
> I don't mind having an option for this, but it would not be appropriate

An option sounds good too.

> as a default behaviour, I think, as nothing else in Mercurial works
> explicitly in terms of directories.

My only argument is that the most common case when you run 'hg status'
without arguments is to see what garbage has been left around. And if
you don't see the orphaned directories in the output, you may not
implement the cleanup scripts correctly. Surely using hg archive for the
packaging would make it not a big deal.

Yet another way is to only show the orphaned directory if it's empty,
that's more eye-friendly (this is an option we have regardless if we
decide to have the feature opt-in or opt-out). Not sure what's best (all
unknown dirs or only the empty ones?).

> > +                        if statmatch(np, st) and not [ x for x in dc if ds in x ]:
> > +                            yield 'd', np, st
> 
> This will iterate over every key in dc, every time through this loop.
> Since dc is often a copy of the entire dirstate map, this is something
> like O(n**2) in behaviour.

Yes math speaking but in practice the number of directories is much
smaller than the number of files so it normally doesn't hurt, but I
agree to improve it. Fixing it should be possible using a proper hash
and creating a filtered equivalent of 'dc' with only "known dirs"
inside. It'll take some memory but it's worth it.

> If you can find a cheaper way to express the idea, and make it a
> non-default behaviour (i.e. plumb it out to the status command as an
> option), the patch should be fine.

Ok.

> Also, it would be worth a look to see if any callers of dirstate.walk
> make assumptions about the range of values they could get back.

I don't think they make any assumption about 'd' and 'b'.


More information about the Mercurial mailing list