cvsps: make debugging easier by adding __repr__() methods.
authorGreg Ward <greg-hg@gerg.ca>
Sat, 18 Apr 2009 09:43:21 -0400
changeset 8080 19229b0b292d
parent 8079 fb162c47000b
child 8082 81aba9e79054
cvsps: make debugging easier by adding __repr__() methods.
hgext/convert/cvsps.py
--- a/hgext/convert/cvsps.py	Sat Apr 18 09:44:51 2009 -0400
+++ b/hgext/convert/cvsps.py	Sat Apr 18 09:43:21 2009 -0400
@@ -39,6 +39,12 @@
     def __init__(self, **entries):
         self.__dict__.update(entries)
 
+    def __repr__(self):
+        return "<%s at 0x%x: %s %s>" % (self.__class__.__name__,
+                                        id(self),
+                                        self.file,
+                                        ".".join(map(str, self.revision)))
+
 class logerror(Exception):
     pass
 
@@ -442,6 +448,11 @@
     def __init__(self, **entries):
         self.__dict__.update(entries)
 
+    def __repr__(self):
+        return "<%s at 0x%x: %s>" % (self.__class__.__name__,
+                                     id(self),
+                                     getattr(self, 'id', "(no id)"))
+
 def createchangeset(ui, log, fuzz=60, mergefrom=None, mergeto=None):
     '''Convert log into changesets.'''