# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 2014-05-23 23:20:30
# Node ID cc33ae50bab30d67d2bf1c219cfe5c64e19602e3
# Parent  7ff01befc7ecf6f27e6dd2320f08f4a5f7e910fb

bundle2: warn about error during initialization in ``newpart`` docstring

As we are moving toward being able to alter a part after its creation, we need
to make the implication of the part being already part of the bundle2 clear.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -408,7 +408,14 @@ class bundle20(object):
         self._parts.append(part)
 
     def newpart(self, typeid, *args, **kwargs):
-        """create a new part and add it to the containers"""
+        """create a new part and add it to the containers
+
+        As the part is directly added to the containers. For now, this means
+        that any failure to properly initialize the part after calling
+        ``newpart`` should result in a failure of the whole bundling process.
+
+        You can still fall back to manually create and add if you need better
+        control."""
         part = bundlepart(typeid, *args, **kwargs)
         self.addpart(part)
         return part