[meld/VersionControlRework: 56/123] vc._vc: Move necessary Entry creation logic into get_entry



commit 7a8bf419591ca5cf5a28b719a30b405c71c37d77
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Mar 29 12:33:51 2015 +1000

    vc._vc: Move necessary Entry creation logic into get_entry
    
    Half of the handling in lookup_files was unnecessary for get_entry
    usage, and having to support it made it harder to refactor
    lookup_files itself.

 meld/vc/_vc.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 2929fa2..93a9e7c 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -251,15 +251,16 @@ class Vc(object):
         method returns return None.
         """
         gfile = Gio.File.new_for_path(path)
-        info = gfile.query_info(
+        file_info = gfile.query_info(
             'standard::*', Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, None)
-        parent = gfile.get_parent().get_path()
 
-        vc_files = self.lookup_files((gfile, info), parent)
-        vc_file = [x for x in vc_files if x.path == path]
-        if not vc_file:
-            return None
-        return vc_file[0]
+        path = gfile.get_path()
+        name = file_info.get_display_name()
+        state = self._get_tree_cache().get(path, STATE_NORMAL)
+        meta = self._tree_meta_cache.get(path, "")
+        isdir = file_info.get_file_type() == Gio.FileType.DIRECTORY
+
+        return Entry(path, name, state, isdir, options=meta)
 
     @classmethod
     def is_installed(cls):


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