Patchwork [1,of,9] bundle2: call _pushbundle2extraparts a bit sooner

login
register
mail settings
Submitter Pierre-Yves David
Date July 7, 2014, 11:01 a.m.
Message ID <59d3193fc0e09971d7be.1404730919@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5122/
State Accepted
Commit 10fcfb615fb4c7ec3b3451e9ef597effb0bce5e5
Headers show

Comments

Pierre-Yves David - July 7, 2014, 11:01 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1404302964 -7200
#      Wed Jul 02 14:09:24 2014 +0200
# Node ID 59d3193fc0e09971d7be39469875b132f1757392
# Parent  61b333b982ea7baab198a188306fc05fb2850179
bundle2: call _pushbundle2extraparts a bit sooner

This is the first step of a refactoring that will ease the inclusion of new part
in the bundle2 push and includes more information (like phases) in this push

We need to move the function a bit sooner to be able to group the generation of
`b2x:check:heads` and `b2x:changegroup` part in an external function. We move it
sooner to preserve parts creation order bundle2 tests rely on. At the ends of this
refactoring the `_pushbundle2extraparts` will be replaced by another mechanism
anyway.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -210,14 +210,14 @@  def _pushbundle2(pushop):
     evolve in the future."""
     bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
     # create reply capability
     capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
     bundler.newpart('b2x:replycaps', data=capsblob)
+    extrainfo = _pushbundle2extraparts(pushop, bundler)
     # Send known heads to the server for race detection.
     if not pushop.force:
         bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
-    extrainfo = _pushbundle2extraparts(pushop, bundler)
     # add the changegroup bundle
     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
     cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
     stream = util.chunkbuffer(bundler.getchunks())
     try: