[PATCH 2 of 6] scmutil: add a dirs class

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Apr 1 20:56:02 CDT 2013


On 1 Apr 2013, at 3:49 PM, Bryan O'Sullivan wrote:

> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1364849265 25200
> #      Mon Apr 01 13:47:45 2013 -0700
> # Node ID eebf8fe7dea5ce3d262f89f848f2024c063b26e4
> # Parent  cd42138d63c3110cbcd07b389f1d99920fb031ac
> scmutil: add a dirs class
> 
> This encapsulates the "bag of directories" structures that are
> currently open-coded (and duplicated) in both the dirstate and
> context modules.
> 
> This will be used, and optionally replaced by a C implementation,
> in upcoming changes.
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -933,3 +933,37 @@ def finddirs(path):
>     while pos != -1:
>         yield path[:pos]
>         pos = path.rfind('/', 0, pos)
> +
> +class dirs(object):
> +    def __init__(self, m, skip=None):

A more descriptive name than 'm' would be helpful here, as would a one-line docstring saying it's a multiset for directories generated from a list of files.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list