bundle2: support the 'targetphase' parameter for the changegroup part
By default unbundled changesets are drafts. We want to reduce the number of
phases changes during unbundling by giving the possibility to the bundle to
indicate the phase of unbundled changesets.
The longer terms goal is to add phase movement tracking in tr.changes and the
'retractboundary' call is making it more complicated than we want.
--- a/mercurial/bundle2.py Tue Jul 11 04:52:56 2017 +0200
+++ b/mercurial/bundle2.py Tue Jul 11 05:11:52 2017 +0200
@@ -1517,7 +1517,8 @@
result = -1 + changedheads
return result
-@parthandler('changegroup', ('version', 'nbchanges', 'treemanifest'))
+@parthandler('changegroup', ('version', 'nbchanges', 'treemanifest',
+ 'targetphase'))
def handlechangegroup(op, inpart):
"""apply a changegroup part on the repo
@@ -1542,8 +1543,12 @@
op.repo.requirements.add('treemanifest')
op.repo._applyopenerreqs()
op.repo._writerequirements()
+ extrakwargs = {}
+ targetphase = inpart.params.get('targetphase')
+ if targetphase is not None:
+ extrakwargs['targetphase'] = int(targetphase)
ret = _processchangegroup(op, cg, tr, 'bundle2', 'bundle2',
- expectedtotal=nbchangesets)
+ expectedtotal=nbchangesets, **extrakwargs)
if op.reply is not None:
# This is definitely not the final form of this
# return. But one need to start somewhere.