[PATCH 1 of 6] bundle2: generate check:heads in a independent function

Ryan McElroy rmcelroy at fb.com
Fri Oct 2 21:33:42 UTC 2015


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1443721694 25200
#      Thu Oct 01 10:48:14 2015 -0700
# Node ID b75c4651b186360298089c0650c2f4eed0046265
# Parent  97dc6ab42aad232c73180dee648685c26662230b
bundle2: generate check:heads in a independent function

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -475,6 +475,14 @@
         return func
     return dec
 
+def _pushb2ctxcheckheads(pushop, bundler):
+    """Generate race condition checking parts
+
+    Exists as an indepedent function to aid extensions
+    """
+    if not pushop.force:
+        bundler.newpart('check:heads', data=iter(pushop.remoteheads))
+
 @b2partsgenerator('changeset')
 def _pushb2ctx(pushop, bundler):
     """handle changegroup push through bundle2
@@ -490,8 +498,9 @@
     pushop.repo.prepushoutgoinghooks(pushop.repo,
                                      pushop.remote,
                                      pushop.outgoing)
-    if not pushop.force:
-        bundler.newpart('check:heads', data=iter(pushop.remoteheads))
+
+    _pushb2ctxcheckheads(pushop, bundler)
+
     b2caps = bundle2.bundle2caps(pushop.remote)
     version = None
     cgversions = b2caps.get('changegroup')


More information about the Mercurial-devel mailing list