[PATCH 3 of 3 V2] bundle2: provide bumber of changesets information to 'addchangegroup'
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Jun 10 13:53:38 CDT 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433717874 25200
# Sun Jun 07 15:57:54 2015 -0700
# Node ID c82e1170ad8ff3f46868eeea99c922fc90d5e51a
# Parent 469c882dc9b84a5bc6c7edbf768fd634cd43bc4c
bundle2: provide bumber of changesets information to 'addchangegroup'
We can now link the two efforts and provided more useful information when
pulling changesets.
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1144,11 +1144,11 @@ def obsmarkersversion(caps):
"""extract the list of supported obsmarkers versions from a bundle2caps dict
"""
obscaps = caps.get('obsmarkers', ())
return [int(c[1:]) for c in obscaps if c.startswith('V')]
- at parthandler('changegroup', ('version',))
+ at parthandler('changegroup', ('version', 'nbchanges'))
def handlechangegroup(op, inpart):
"""apply a changegroup part on the repo
This is a very early implementation that will massive rework before being
inflicted to any end-user.
@@ -1163,11 +1163,15 @@ def handlechangegroup(op, inpart):
# We should raise an appropriate exception here
unpacker = changegroup.packermap[unpackerversion][1]
cg = unpacker(inpart, 'UN')
# the source and url passed here are overwritten by the one contained in
# the transaction.hookargs argument. So 'bundle2' is a placeholder
- ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
+ nbchangesets = None
+ if 'nbchanges' in inpart.params:
+ nbchangesets = int(inpart.params.get('nbchanges'))
+ ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2',
+ expectedtotal=nbchangesets)
op.records.add('changegroup', {'return': ret})
if op.reply is not None:
# This is definitely not the final form of this
# return. But one need to start somewhere.
part = op.reply.newpart('reply:changegroup', mandatory=False)
More information about the Mercurial-devel
mailing list