[PATCH 1 of 3] manifest: add id(self) to treemanifest __repr__

Augie Fackler raf at durin42.com
Mon Sep 28 13:50:15 UTC 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1443215856 14400
#      Fri Sep 25 17:17:36 2015 -0400
# Node ID cb5276f84e12f2f3502edc8d9ba5ffbfae1c4ae9
# Parent  0224d22ef5d815c86d7ebce6644f056c406acbfd
manifest: add id(self) to treemanifest __repr__

Also rename __str__ to __repr__ since that's what we really want for
pdb.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -476,11 +476,11 @@ class treemanifest(object):
         return (not self._files and (not self._dirs or
                 all(m._isempty() for m in self._dirs.values())))
 
-    def __str__(self):
-        return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s>' %
+    def __repr__(self):
+        return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' %
                 (self._dir, revlog.hex(self._node),
                  bool(self._load is _noop),
-                 self._dirty))
+                 self._dirty, id(self)))
 
     def dir(self):
         '''The directory that this tree manifest represents, including a


More information about the Mercurial-devel mailing list