[PATCH 2 of 4] bundle2: support the 'targetphase' parameter for the changegroup part

Boris Feld boris.feld at octobus.net
Wed Jul 12 11:39:04 EDT 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1499742712 -7200
#      Tue Jul 11 05:11:52 2017 +0200
# Node ID a600e69f8de0b75998a11502c3cb868936e6cb4a
# Parent  e46f9cabad79aa5429c2e8d80d5c60e42e42abb1
# EXP-Topic tr.changes.phases
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 -r e46f9cabad79 -r a600e69f8de0 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
 
- at parthandler('changegroup', ('version', 'nbchanges', 'treemanifest'))
+ at 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.


More information about the Mercurial-devel mailing list