[PATCH 3 of 9] bundle2: add a ``bundle20.nbparts`` property

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Mon Jul 7 06:02:01 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1404310674 -7200
#      Wed Jul 02 16:17:54 2014 +0200
# Node ID 43db2776ef385be3ade68d49044adc2a39477510
# Parent  05fea039be398d565c1fba9403d796ee0bb52816
bundle2: add a ``bundle20.nbparts`` property

This property can be used to know how much parts have been added to the bundle2.
This will be useful to check if any part have been generated for a push.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -393,10 +393,15 @@ class bundle20(object):
         self.ui = ui
         self._params = []
         self._parts = []
         self.capabilities = dict(capabilities)
 
+    @property
+    def nbparts(self):
+        """total number of parts added to the bundler"""
+        return len(self._parts)
+
     # methods used to defines the bundle2 content
     def addparam(self, name, value=None):
         """add a stream level parameter"""
         if not name:
             raise ValueError('empty parameter name')


More information about the Mercurial-devel mailing list