Patchwork [3,of,3,V2] bundle2: provide bumber of changesets information to 'addchangegroup'

login
register
mail settings
Submitter Pierre-Yves David
Date June 10, 2015, 6:53 p.m.
Message ID <c82e1170ad8ff3f46868.1433962418@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9586/
State Accepted
Headers show

Comments

Pierre-Yves David - June 10, 2015, 6:53 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Gilles Moris - June 11, 2015, 5:31 a.m.
Le 10/06/2015 20:53, Pierre-Yves David a écrit :
> # HG changeset patch
> # User Pierre-Yves David<pierre-yves.david@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'
bumber => number
Pierre-Yves David - June 11, 2015, 7:08 a.m.
On 06/10/2015 10:31 PM, Gilles Moris wrote:
> Le 10/06/2015 20:53, Pierre-Yves David a écrit :
>> # HG changeset patch
>> # User Pierre-Yves David<pierre-yves.david@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'
> bumber => number

That's a bummer, can the queuer fix that in flight?

Thanks for spotting that.
Martin von Zweigbergk - June 12, 2015, 5:35 p.m.
On Thu, Jun 11, 2015 at 12:09 AM Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

>
>
> On 06/10/2015 10:31 PM, Gilles Moris wrote:
> > Le 10/06/2015 20:53, Pierre-Yves David a écrit :
> >> # HG changeset patch
> >> # User Pierre-Yves David<pierre-yves.david@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'
> > bumber => number
>
> That's a bummer, can the queuer fix that in flight?
>

Done. Pushing to the clowncopter shortly. Thanks.


>
> Thanks for spotting that.
>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

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')]
 
-@parthandler('changegroup', ('version',))
+@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)