[meld] Improve our debug printing of vc.Entry objects



commit 7b5ba0c7b96777eb9b666cae46940c6266224ccd
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun May 19 09:11:41 2013 +1000

    Improve our debug printing of vc.Entry objects

 meld/vc/_vc.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 8da6e7b..e49b163 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -52,19 +52,25 @@ class Entry(object):
     # These are the possible states of files. Be sure to get the colons correct.
     states = _("Ignored:Unversioned:::Error::Newly added:Modified:Conflict:Removed:Missing:Not 
present").split(":")
     states[STATE_CONFLICT] = "<b>%s</b>" % states[STATE_CONFLICT]
-    assert len(states)==STATE_MAX
+    assert len(states) == STATE_MAX
 
     def __init__(self, path, name, state):
         self.path = path
         self.state = state
         self.parent, self.name = os.path.split(path.rstrip("/"))
+
     def __str__(self):
-        return "<%s:%s %s>\n" % (self.__class__, self.name, (self.path, self.state))
+        return "<%s:%s %s>" % (self.__class__.__name__, self.path,
+                               self.get_status() or "Normal")
+
     def __repr__(self):
-        return "%s %s\n" % (self.name, (self.path, self.state))
+        return "%s(%r, %r, %r)" % (self.__class__.__name__, self.name,
+                                   self.path, self.state)
+
     def get_status(self):
         return self.states[self.state]
 
+
 class Dir(Entry):
     def __init__(self, path, name, state):
         Entry.__init__(self, path, name, state)
@@ -73,6 +79,7 @@ class Dir(Entry):
         self.tag = ""
         self.options = ""
 
+
 class File(Entry):
     def __init__(self, path, name, state, rev="", tag="", options=""):
         assert path[-1] != "/"
@@ -82,6 +89,7 @@ class File(Entry):
         self.tag = tag
         self.options = options
 
+
 class Vc(object):
 
     PATCH_STRIP_NUM = 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]