# HG changeset patch # User Boris Feld # Date 2017-07-11 03:11:52 # Node ID 39d4e5a66f5a3e923c9d27036e876eff3f4fb9e4 # Parent 168ba5c4dfcbe076747986a4d7305e0c93e5a9a7 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. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1517,7 +1517,8 @@ def combinechangegroupresults(op): 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 @@ def handlechangegroup(op, inpart): 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.