[PATCH RFC] forest extension

Robin Farine robin.farine at terminus.org
Sat Dec 9 12:13:09 CST 2006


On Saturday December 9 2006 16:36, Thomas Arendsen Hein wrote:

> > +def enumerate_repos(ui, top='', **opts):
> > +    """Generate a lexicographically sorted list of repository
> > roots."""
>
> This should somehow be integrated with util.walkrepos(), which of
> course has to be extended with the walkhg code.

The problem with util.walkrepos() is that it relies on os.walk() 
which does not specify in which order it produces its output. I 
like to see the list of repositories in lexicographic order for 
obvious reasons. An alternative would be to walk the repos and 
store the result in a list, sort it and return it. This has the 
small disadventage of seeing no output at all for a long time on 
large trees, but I think it is the best solution when using 
util.walkrepos().

>
> > +        for e in entries:
> > +            if e == 'data' and os.path.split(root)[1] ==
> > '.hg': +                continue
>
> This code will break real soon with the advent of store.
> There is a repo.spath now, which should be excluded from walking.

OK, util.walkrepos() should probably take care of this when extended 
to walk .hg directories.

> Generally there are some repository methods which should be used
> more frequently in the forest extension.

I knew about util.walkrepos() but do you mean there are other 
obvious places with opportunities to reuse code ?

Thanks for the feedback,

Robin


More information about the Mercurial-devel mailing list