[meld/meld-1-8] Fix logic for subversion repository selection



commit dff1468b010bd912053212f992985bb841ec6b24
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Oct 4 17:07:26 2013 +1000

    Fix logic for subversion repository selection

 meld/vc/__init__.py |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/meld/vc/__init__.py b/meld/vc/__init__.py
index 92a4da0..f616ec6 100644
--- a/meld/vc/__init__.py
+++ b/meld/vc/__init__.py
@@ -73,24 +73,21 @@ def get_vcs(location):
     """
 
     vcs = []
-    max_depth = 0
     for plugin in _plugins:
         try:
             vc = plugin.Vc(location)
         except ValueError:
             continue
+        vcs.append(vc)
 
-        # Choose the deepest root we find, unless it's from a VC that
-        # doesn't walk; these can be spurious as the real root may be
-        # much higher up in the tree.
-        depth = len(vc.root)
-        if depth > max_depth and vc.VC_ROOT_WALK:
-            vcs, max_depth = [], depth
-        if depth >= max_depth:
-            vcs.append(vc)
+    # Choose the deepest root we find, unless it's from a VC that
+    # doesn't walk; these can be spurious as the real root may be
+    # much higher up in the tree.
+    max_depth = max(len(vc.root) for vc in vcs if vc.VC_ROOT_WALK)
+    vcs = [vc for vc in vcs if not vc.VC_ROOT_WALK or
+           (len(vc.root) == max_depth and vc.VC_ROOT_WALK)]
 
     if not vcs:
-        # No plugin recognized that location, fallback to _null
         return [_null.Vc(location)]
 
     vc_sort_key = lambda v: vc_sort_order.index(v.NAME)


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