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

login
register
mail settings
Submitter Augie Fackler
Date Sept. 28, 2015, 1:50 p.m.
Message ID <cb5276f84e12f2f3502e.1443448215@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/10668/
State Accepted
Headers show

Comments

Augie Fackler - Sept. 28, 2015, 1:50 p.m.
# HG changeset patch
# User Augie Fackler <augie@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.

Patch

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