[PATCH] localrepo: send client's bundlecaps to a server during a pull

Wojciech Lopata lopek at fb.com
Fri Aug 30 15:18:59 CDT 2013

It is likely that this patch is bad, since I'm not sure if I know what bundlecaps truly are (and I make them a property of localrepo). I didn't find any piece of code that would be making use of this feature. I will appreciate someone taking a look and pointing me the right way of doing what I want to do.

My usecase: I change format of the manifest. To make pulls between two repos (one of which might not be using my extension) possible, I need to convert data stored in manifest to 'regular' format before bundling. This is slow as requires me to build every revision that is going to be transported in a bundle.

To avoid conversion when pull occurs between to repos with the extension I want client to be able to tell server "don't convert data to regular format". And bundlecaps seem to be exactly what I want (at least with this patch, and a dozen of lines of code in my extension, I got what I wanted).

> -----Original Message-----
> From: mercurial-devel-bounces at selenic.com [mailto:mercurial-devel-
> bounces at selenic.com] On Behalf Of Wojciech Lopata
> Sent: Friday, August 30, 2013 1:14 PM
> To: mercurial-devel at selenic.com
> Subject: [PATCH] localrepo: send client's bundlecaps to a server during a pull
> # HG changeset patch
> # User Wojciech Lopata <lopek at fb.com>
> # Date 1377891837 25200
> #      Fri Aug 30 12:43:57 2013 -0700
> # Node ID b78c0dcf3d674c23462c1b68dff43e6d3277f295
> # Parent  73d761ed3dbddd06d4a65027ef82bb77ae0ec82f
> localrepo: send client's bundlecaps to a server during a pull
> Thanks to this change extensions that modify format of revlog and are used
> on client and server side will be able to customize format of bundles sent
> during a pull, and possibly make this operation faster.
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -148,6 +148,7 @@
>                                          'dotencode'))
>      openerreqs = set(('revlogv1', 'generaldelta'))
>      requirements = ['revlogv1']
> +    bundlecaps = set()
>      filtername = None
>      def _baserequirements(self, create):
> @@ -1671,7 +1672,7 @@
>                  if remote.capable('getbundle'):
>                      # TODO: get bundlecaps from remote
>                      cg = remote.getbundle('pull', common=common,
> -                                          heads=heads or rheads)
> +                            heads=heads or rheads, bundlecaps=self.bundlecaps)
>                  elif heads is None:
>                      cg = remote.changegroup(fetch, 'pull')
>                  elif not remote.capable('changegroupsubset'):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

More information about the Mercurial-devel mailing list