diff -r 9fea6b38a8da -r 37d7cf569cf3 mercurial/wireproto.py --- a/mercurial/wireproto.py Sat Jan 02 15:14:55 2016 -0800 +++ b/mercurial/wireproto.py Sun Dec 20 11:56:24 2015 -0800 @@ -491,12 +491,33 @@ % (cmd, ",".join(others))) return opts -def bundle1allowed(ui, action): - """Whether a bundle1 operation is allowed from the server.""" +def bundle1allowed(repo, action): + """Whether a bundle1 operation is allowed from the server. + + Priority is: + + 1. server.bundle1gd. (if generaldelta active) + 2. server.bundle1. + 3. server.bundle1gd (if generaldelta active) + 4. server.bundle1 + """ + ui = repo.ui + gd = 'generaldelta' in repo.requirements + + if gd: + v = ui.configbool('server', 'bundle1gd.%s' % action, None) + if v is not None: + return v + v = ui.configbool('server', 'bundle1.%s' % action, None) if v is not None: return v + if gd: + v = ui.configbool('server', 'bundle1gd', None) + if v is not None: + return v + return ui.configbool('server', 'bundle1', True) # list of commands @@ -665,7 +686,7 @@ raise KeyError('unknown getbundle option type %s' % keytype) - if not bundle1allowed(repo.ui, 'pull'): + if not bundle1allowed(repo, 'pull'): if not exchange.bundle2requested(opts.get('bundlecaps')): return ooberror(bundle2required) @@ -781,7 +802,7 @@ fp.seek(0) gen = exchange.readbundle(repo.ui, fp, None) if (isinstance(gen, changegroupmod.cg1unpacker) - and not bundle1allowed(repo.ui, 'push')): + and not bundle1allowed(repo, 'push')): return ooberror(bundle2required) r = exchange.unbundle(repo, gen, their_heads, 'serve',