[PATCH 6 of 8] changegroup: write root manifests and subdir manifests in a single loop

Augie Fackler raf at durin42.com
Wed Feb 24 17:00:17 EST 2016


On Tue, Feb 23, 2016 at 11:52:31AM -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1455348618 28800
> #      Fri Feb 12 23:30:18 2016 -0800
> # Node ID 54d19d993e13b9edabbabc518a99c47d75c85f76
> # Parent  85c69fa32772e880d3a682e9cc031feaefc2963a
> changegroup: write root manifests and subdir manifests in a single loop

Queued patches 1-6. Will look at 7 and 8 later, as I have to go eat supper now.

>
> This is another step towards making the manifest generation recurse
> along the directory trees. The loop over 'tmfnodes' now takes the form
> of a queue. At this point, we only add to the queue twice: we add the
> root manifests, and, while visiting the root manifest revisions, we
> add all subdirectory revisions (for treemanifest repos). Thus, any
> iterations over 'tmfnodes' after the first will not add any items and
> the "queue" will just keep shrinking.
>
> diff -r 85c69fa32772 -r 54d19d993e13 mercurial/changegroup.py
> --- a/mercurial/changegroup.py	Fri Feb 12 23:26:15 2016 -0800
> +++ b/mercurial/changegroup.py	Fri Feb 12 23:30:18 2016 -0800
> @@ -756,7 +756,7 @@
>                            mfchangedfiles, fnodes):
>          repo = self._repo
>          ml = repo.manifest
> -        tmfnodes = {}
> +        tmfnodes = {'': mfs}
>
>          # Callback for the manifest, used to collect linkrevs for filelog
>          # revisions.
> @@ -825,17 +825,16 @@
>                  return clnode
>              return lookupmflinknode
>
> -        mfnodes = self.prune(ml, mfs, commonrevs)
>          size = 0
> -        for x in self._packmanifests('', mfnodes, makelookupmflinknode('')):
> -            size += len(x)
> -            yield x
> -        for dir, nodes in tmfnodes.iteritems():
> +        while tmfnodes:
> +            dir = min(tmfnodes)
> +            nodes = tmfnodes[dir]
>              prunednodes = self.prune(ml.dirlog(dir), nodes, commonrevs)
>              for x in self._packmanifests(dir, prunednodes,
>                                           makelookupmflinknode(dir)):
>                  size += len(x)
>                  yield x
> +            del tmfnodes[dir]
>          self._verbosenote(_('%8.i (manifests)\n') % size)
>          yield self._manifestsdone()
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list