bundle2: support the 'targetphase' parameter for the changegroup part
authorBoris Feld <boris.feld@octobus.net>
Tue, 11 Jul 2017 05:11:52 +0200
changeset 33407 39d4e5a66f5a
parent 33406 168ba5c4dfcb
child 33408 e3867c712d51
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.
mercurial/bundle2.py
--- 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.