Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 35785:ba15580e53d5
exchange: return bundle info from getbundlechunks() (API)
We generally want a mechanism to pass information about the
generated bundle back to callers (in addition to the byte stream).
Ideally we would return a bundler from this function and have the
caller code to an interface. But the bundling APIs are not great
and getbundlechunks() is the best API we have for obtaining bundle
contents in a unified manner.
We change getbundlechunks() to return a dict that we can use to
communicate metadata.
We populate that dict with the bundle version number to demonstrate
some value.
.. api::
exchange.getbundlechunks() now returns a 2-tuple instead of just
an iterator.
Differential Revision: https://phab.mercurial-scm.org/D1925
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 20 Jan 2018 13:41:57 -0800 |
parents | c97639ad6874 |
children | a84dbc87dae9 |
comparison
equal
deleted
inserted
replaced
35784:08cc94dd3d3c | 35785:ba15580e53d5 |
---|---|
875 if changegroup and not common and clheads == heads: | 875 if changegroup and not common and clheads == heads: |
876 raise error.Abort( | 876 raise error.Abort( |
877 _('server has pull-based clones disabled'), | 877 _('server has pull-based clones disabled'), |
878 hint=_('remove --pull if specified or upgrade Mercurial')) | 878 hint=_('remove --pull if specified or upgrade Mercurial')) |
879 | 879 |
880 chunks = exchange.getbundlechunks(repo, 'serve', | 880 info, chunks = exchange.getbundlechunks(repo, 'serve', |
881 **pycompat.strkwargs(opts)) | 881 **pycompat.strkwargs(opts)) |
882 except error.Abort as exc: | 882 except error.Abort as exc: |
883 # cleanly forward Abort error to the client | 883 # cleanly forward Abort error to the client |
884 if not exchange.bundle2requested(opts.get('bundlecaps')): | 884 if not exchange.bundle2requested(opts.get('bundlecaps')): |
885 if proto.name == 'http': | 885 if proto.name == 'http': |
886 return ooberror(str(exc) + '\n') | 886 return ooberror(str(exc) + '\n') |