[meld] Add 'non-existant' state for DirDiff, to differentiate 'missing' in VC



commit a527052d237f4963148a6057a6affaf065683e78
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 7 10:22:59 2012 +1000

    Add 'non-existant' state for DirDiff, to differentiate 'missing' in VC
    
    Here we workaround the sharing of states between VcView and DirDiff by
    adding a 'non-existant' state for use in DirDiff, since the semantics
    of 'missing' in VC and DirDiff are completely different.

 meld/dirdiff.py |    3 ++-
 meld/tree.py    |    6 ++++--
 meld/vc/_vc.py  |    4 ++--
 meld/vcview.py  |    2 --
 4 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index ce5d376..ffa9c04 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -212,6 +212,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         tree.STATE_EMPTY: None,
         tree.STATE_MODIFIED: "replace",
         tree.STATE_MISSING: "delete",
+        tree.STATE_NONEXIST: "delete",
     }
 
     state_actions = {
@@ -1050,7 +1051,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 one_isdir[j] = isdir
         for j in range(self.model.ntree):
             if not mod_times[j]:
-                self.model.set_path_state(it, j, tree.STATE_MISSING,
+                self.model.set_path_state(it, j, tree.STATE_NONEXIST,
                                           True in one_isdir)
         return different
 
diff --git a/meld/tree.py b/meld/tree.py
index e7621dc..8ac27ba 100644
--- a/meld/tree.py
+++ b/meld/tree.py
@@ -30,7 +30,7 @@ from meld.vc._vc import \
     STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \
     STATE_ERROR, STATE_EMPTY, STATE_NEW, \
     STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \
-    STATE_MISSING, STATE_MAX
+    STATE_MISSING, STATE_NONEXIST, STATE_MAX
 
 
 class DiffTreeStore(gtk.TreeStore):
@@ -75,7 +75,8 @@ class DiffTreeStore(gtk.TreeStore):
             (mod_fg, roman,  bold,   None),  # STATE_MODIFIED
             (con_fg, roman,  bold,   None),  # STATE_CONFLICT
             (del_fg, roman,  bold,   True),  # STATE_REMOVED
-            (unk_fg, roman,  normal, True),  # STATE_MISSING
+            (del_fg, roman,  bold,   True),  # STATE_MISSING
+            (unk_fg, roman,  normal, True),  # STATE_NONEXIST
         ]
 
         self.icon_details = [
@@ -91,6 +92,7 @@ class DiffTreeStore(gtk.TreeStore):
             ("text-x-generic", "folder", con_fg, None),    # CONFLICT
             ("text-x-generic", "folder", del_fg, None),    # REMOVED
             ("text-x-generic", "folder", unk_fg, unk_fg),  # MISSING
+            ("text-x-generic", "folder", unk_fg, unk_fg),  # NONEXIST
         ]
 
         assert len(self.icon_details) == len(self.text_attributes) == STATE_MAX
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 09d9c6d..2fa878d 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -33,11 +33,11 @@ from gettext import gettext as _
 STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \
 STATE_ERROR, STATE_EMPTY, STATE_NEW, \
 STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \
-STATE_MISSING, STATE_MAX = range(12)
+STATE_MISSING, STATE_NONEXIST, STATE_MAX = range(13)
 
 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").split(":")
+    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
 
diff --git a/meld/vcview.py b/meld/vcview.py
index 4e224f6..f5fff43 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -83,8 +83,6 @@ COL_LOCATION, COL_STATUS, COL_REVISION, COL_TAG, COL_OPTIONS, COL_END = range(tr
 class VcTreeStore(tree.DiffTreeStore):
     def __init__(self):
         tree.DiffTreeStore.__init__(self, 1, [str] * 5)
-        self.text_attributes[tree.STATE_MISSING] = \
-                ("#000088", pango.STYLE_NORMAL, pango.WEIGHT_BOLD, True)
 
 ################################################################################
 # filters



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