[PATCH 1 of 6] changegroup: expose list of changesets from getsubsetraw

Gregory Szorc gregory.szorc at gmail.com
Tue May 26 00:48:53 UTC 2015


I truncated this series at 6 patches to appease the patchbomb gods. The
crux of this work is adding transfer of hgtags fnodes cache data as a
bundle2 part.
https://hg.mozilla.org/users/gszorc_mozilla.com/hg/rev/94ac12a1fd57 and its
3 parents are ready for review. But I won't patchbomb them until this
series is queued.

Yes, I'll probably add branch map transfer as well. Maybe not today, though.

On Mon, May 25, 2015 at 5:42 PM, Gregory Szorc <gregory.szorc at gmail.com>
wrote:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1432589936 25200
> #      Mon May 25 14:38:56 2015 -0700
> # Node ID ea28b7239085bbc7d561ab6aa6f86bdc19f77a25
> # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
> changegroup: expose list of changesets from getsubsetraw
>
> Currently, when generating changegroups, it is possible for the caller
> to not know exactly what data is inside without parsing the returned
> data stream. This is inefficient and adds complexity.
>
> Return the list of changesets from getsubsetraw to make this data
> more widely available.
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -549,8 +549,13 @@ def _changegroupinfo(repo, nodes, source
>          for node in nodes:
>              repo.ui.debug("%s\n" % hex(node))
>
>  def getsubsetraw(repo, outgoing, bundler, source, fastpath=False):
> +    """Obtain changegroup data.
> +
> +    Returns a list of binary changeset nodes and an iterator of raw
> +    changegroup data.
> +    """
>      repo = repo.unfiltered()
>      commonrevs = outgoing.common
>      csets = outgoing.missing
>      heads = outgoing.missingheads
> @@ -562,12 +567,12 @@ def getsubsetraw(repo, outgoing, bundler
>              repo.filtername is None and heads == sorted(repo.heads()))
>
>      repo.hook('preoutgoing', throw=True, source=source)
>      _changegroupinfo(repo, csets, source)
> -    return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
> +    return csets, bundler.generate(commonrevs, csets, fastpathlinkrev,
> source)
>
>  def getsubset(repo, outgoing, bundler, source, fastpath=False,
> version='01'):
> -    gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath)
> +    csets, gengroup = getsubsetraw(repo, outgoing, bundler, source,
> fastpath)
>      return packermap[version][1](util.chunkbuffer(gengroup), 'UN')
>
>  def changegroupsubset(repo, roots, heads, source, version='01'):
>      """Compute a changegroup consisting of all the nodes that are
> @@ -602,9 +607,9 @@ def getlocalchangegroupraw(repo, source,
>      precomputed sets in outgoing. Returns a raw changegroup generator."""
>      if not outgoing.missing:
>          return None
>      bundler = packermap[version][0](repo, bundlecaps)
> -    return getsubsetraw(repo, outgoing, bundler, source)
> +    return getsubsetraw(repo, outgoing, bundler, source)[1]
>
>  def getlocalchangegroup(repo, source, outgoing, bundlecaps=None):
>      """Like getbundle, but taking a discovery.outgoing as an argument.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20150525/6a8e2967/attachment-0002.html>


More information about the Mercurial-devel mailing list