bundle2: clarify the docstring of unpackermixin methods
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 09 Apr 2017 18:12:54 +0200
changeset 31862 9bd9e9cb3f69
parent 31861 6d055cd6669f
child 31863 cd7aaf344d83
bundle2: clarify the docstring of unpackermixin methods The unpackermixin is a utility used to implement the bundle2 protocol. It should not be used when writing part handlers. We update the docstring to clarify this.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Sun Apr 09 18:16:09 2017 +0200
+++ b/mercurial/bundle2.py	Sun Apr 09 18:12:54 2017 +0200
@@ -621,12 +621,24 @@
                           util.safehasattr(fp, 'tell'))
 
     def _unpack(self, format):
-        """unpack this struct format from the stream"""
+        """unpack this struct format from the stream
+
+        This method is meant for internal usage by the bundle2 protocol only.
+        They directly manipulate the low level stream including bundle2 level
+        instruction.
+
+        Do not use it to implement higher-level logic or methods."""
         data = self._readexact(struct.calcsize(format))
         return _unpack(format, data)
 
     def _readexact(self, size):
-        """read exactly <size> bytes from the stream"""
+        """read exactly <size> bytes from the stream
+
+        This method is meant for internal usage by the bundle2 protocol only.
+        They directly manipulate the low level stream including bundle2 level
+        instruction.
+
+        Do not use it to implement higher-level logic or methods."""
         return changegroup.readexactly(self._fp, size)
 
     def seek(self, offset, whence=0):