changeset 30872:1f51b4658f21

bundle2: implement a basic __repr__ for bundle2 part We display basic data as the part id and part type. This make debugging bundle2 related code friendlier.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 02 Feb 2017 14:19:48 +0100
parents e527c11375a4
children 1791be8a95c5
files mercurial/bundle2.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Feb 02 11:03:41 2017 +0100
+++ b/mercurial/bundle2.py	Thu Feb 02 14:19:48 2017 +0100
@@ -862,6 +862,11 @@
         self._generated = None
         self.mandatory = mandatory
 
+    def __repr__(self):
+        cls = "%s.%s" % (self.__class__.__module__, self.__class__.__name__)
+        return ('<%s object at %x; id: %s; type: %s; mandatory: %s>'
+                % (cls, id(self), self.id, self.type, self.mandatory))
+
     def copy(self):
         """return a copy of the part