Mercurial > public > mercurial-scm > hg
diff mercurial/wireproto.py @ 32260:d0d9a4fca59b
clone: add a server-side option to disable full getbundles (pull-based clones)
For large enough repositories, pull-based clones take too long, and an attempt
to use them indicates some sort of configuration or other issue or maybe an
outdated Mercurial. Add a config option to disable them.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 11 May 2017 10:50:05 -0700 |
parents | 53865692a354 |
children | bd872f64a8ba |
line wrap: on
line diff
--- a/mercurial/wireproto.py Mon May 08 20:01:06 2017 -0700 +++ b/mercurial/wireproto.py Thu May 11 10:50:05 2017 -0700 @@ -16,6 +16,7 @@ from .node import ( bin, hex, + nullid, ) from . import ( @@ -841,6 +842,17 @@ hint=bundle2requiredhint) try: + if repo.ui.configbool('server', 'disablefullbundle', False): + # Check to see if this is a full clone. + clheads = set(repo.changelog.heads()) + heads = set(opts.get('heads', set())) + common = set(opts.get('common', set())) + common.discard(nullid) + if not common and clheads == heads: + raise error.Abort( + _('server has pull-based clones disabled'), + hint=_('remove --pull if specified or upgrade Mercurial')) + chunks = exchange.getbundlechunks(repo, 'serve', **opts) except error.Abort as exc: # cleanly forward Abort error to the client