mercurial/wireproto.py
changeset 32300 d0d9a4fca59b
parent 31460 53865692a354
child 32331 bd872f64a8ba
--- 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