Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.py @ 27734:5c0fd878779c
treemanifests: set bundle2 part parameter indicating treemanifest
By adding a mandatory 'treemanifest' parameter in the bundle2 part, we
make it possible for the recipient to set repo requirements before the
manifest revlog is accessed.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 08 Jan 2016 21:13:06 -0800 |
parents | 58f1645f72c3 |
children | a40e2f7fe49d |
line wrap: on
line diff
--- a/mercurial/bundle2.py Wed Jan 06 20:05:18 2016 +0000 +++ b/mercurial/bundle2.py Fri Jan 08 21:13:06 2016 -0800 @@ -1262,7 +1262,7 @@ obscaps = caps.get('obsmarkers', ()) return [int(c[1:]) for c in obscaps if c.startswith('V')] -@parthandler('changegroup', ('version', 'nbchanges')) +@parthandler('changegroup', ('version', 'nbchanges', 'treemanifest')) def handlechangegroup(op, inpart): """apply a changegroup part on the repo @@ -1284,6 +1284,15 @@ nbchangesets = None if 'nbchanges' in inpart.params: nbchangesets = int(inpart.params.get('nbchanges')) + if ('treemanifest' in inpart.params and + 'treemanifest' not in op.repo.requirements): + if len(op.repo.changelog) != 0: + raise error.Abort(_( + "bundle contains tree manifests, but local repo is " + "non-empty and does not use tree manifests")) + op.repo.requirements.add('treemanifest') + op.repo._applyopenerreqs() + op.repo._writerequirements() ret = cg.apply(op.repo, 'bundle2', 'bundle2', expectedtotal=nbchangesets) op.records.add('changegroup', {'return': ret}) if op.reply is not None: