[PATCH 10 of 14] changegroup: collect manifest nodes for shallow clone

Nicolas Dumazet nicdumz at gmail.com
Fri Jul 16 03:10:06 CDT 2010


On Fri, 16 Jul 2010 12:45:18 +0530
Vishakh H <vsh426 at gmail.com> wrote:

> # HG changeset patch
> # User Vishakh H <vsh426 at gmail.com>
> # Date 1279263210 -19800
> # Node ID 2a420893bd473f2d187089e314a86f8ccfe5979f
> # Parent  6235071ccd5e7973389a890abb64a88c6d8ccb27
> changegroup: collect manifest nodes for shallow clone
> 
> collect changedfiles and manifests when changelog node is descendant
> of shallowroot.
> 
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -56,14 +56,15 @@
>      "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
>  }
>  
> -def collector(cl, mmfs, files):
> +def collector(cl, mmfs, files, sh_cl=set()):

I know that "cl" and "mmfs" are not particurly self-descriptive, but
what is supposed to mean "sh_cl" here?
I am also unsure about using an object as a default argument here: it's
usually considered dangerous as the same object will be used if the
function is called several times. Why not None?

-Nicolas.

>      # Gather information about changeset nodes going out in a bundle.
>      # We want to gather manifests needed and filelogs affected.
>      def collect(node):
>          c = cl.read(node)
> -        for fn in c[3]:
> -            files.setdefault(fn, fn)
> -        mmfs.setdefault(c[0], node)
> +        if not sh_cl or node in sh_cl:
> +            for fn in c[3]:
> +                files.setdefault(fn, fn)
> +            mmfs.setdefault(c[0], node)
>      return collect
>  
>  # hgweb uses this list to communicate its preferred type
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Nicolas Dumazet — NicDumZ


More information about the Mercurial-devel mailing list