meld r1058 - trunk/vc



Author: stevek
Date: Sat Sep 27 13:14:16 2008
New Revision: 1058
URL: http://svn.gnome.org/viewvc/meld?rev=1058&view=rev

Log:
Bug 519911 â consolidate vc/git.py duplicated code (Vincent Legoll)


Modified:
   trunk/vc/_vc.py
   trunk/vc/git.py

Modified: trunk/vc/_vc.py
==============================================================================
--- trunk/vc/_vc.py	(original)
+++ trunk/vc/_vc.py	Sat Sep 27 13:14:16 2008
@@ -98,6 +98,9 @@
     def uncache_inventory(self):
         pass
 
+    def listdir_filter(self, entries):
+        return [f for f in entries if f[0]!="." and f!="CVS"]
+
     def listdir(self, start):
         if start=="": start="."
         if start[-1] != "/": start+="/"
@@ -108,7 +111,7 @@
             entries.sort()
         except OSError:
             entries = []
-        for f in [f for f in entries if f[0]!="." and f!="CVS" and f!=".svn"]:
+        for f in self.listdir_filter(entries):
             fname = start + f
             lname = fname
             if os.path.isdir(fname):

Modified: trunk/vc/git.py
==============================================================================
--- trunk/vc/git.py	(original)
+++ trunk/vc/git.py	Sat Sep 27 13:14:16 2008
@@ -143,23 +143,5 @@
                     retfiles.append( _vc.File(path, name, state) )
         return retdirs, retfiles
 
-    def listdir(self, start):
-        # just like _vc.Vc.listdir, but ignores just .git
-        if start=="": start="."
-        if start[-1] != "/": start+="/"
-        cfiles = []
-        cdirs = []
-        try:
-            entries = os.listdir(start)
-            entries.sort()
-        except OSError:
-            entries = []
-        for f in [f for f in entries if f!=".git"]:
-            fname = start + f
-            lname = fname
-            if os.path.isdir(fname):
-                cdirs.append( (f, lname) )
-            else:
-                cfiles.append( (f, lname) )
-        dirs, files = self.lookup_files(cdirs, cfiles)
-        return dirs+files
+    def listdir_filter(self, entries):
+        return [f for f in entries if f!=".git"]



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