Rev 2374: Give RevisionTree a repr method. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/dirstate/

Robert Collins robertc at robertcollins.net
Fri Feb 23 02:04:55 GMT 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/dirstate/

------------------------------------------------------------
revno: 2374
revision-id: robertc at robertcollins.net-20070223020403-ojzvhu79itqx004a
parent: robertc at robertcollins.net-20070223013602-qrkqs22lbp5jrfsv
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Fri 2007-02-23 13:04:03 +1100
message:
  Give RevisionTree a repr method.
modified:
  bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
=== modified file 'bzrlib/revisiontree.py'
--- a/bzrlib/revisiontree.py	2007-02-22 15:04:35 +0000
+++ b/bzrlib/revisiontree.py	2007-02-23 02:04:03 +0000
@@ -29,10 +29,6 @@
     """Tree viewing a previous revision.
 
     File text can be retrieved from the text store.
-
-    TODO: Some kind of `__repr__` method, but a good one
-           probably means knowing the branch and revision number,
-           or at least passing a description to the constructor.
     """
     
     def __init__(self, branch, inv, revision_id):
@@ -145,6 +141,10 @@
     def lock_read(self):
         self._repository.lock_read()
 
+    def __repr__(self):
+        return '<%s instance at %x, rev_id=%r>' % (
+            self.__class__.__name__, id(self), self._revision_id)
+
     def unlock(self):
         self._repository.unlock()
 



More information about the bazaar-commits mailing list