[meld] Change VC root selection for VC's that don't walk to find the root
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Change VC root selection for VC's that don't walk to find the root
- Date: Sat, 21 Sep 2013 22:38:59 +0000 (UTC)
commit 502956935bf4394c6f517070ff3cafb93b418e82
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Sep 22 08:30:19 2013 +1000
Change VC root selection for VC's that don't walk to find the root
When invoked on subdirectories of a repository with both root-walking
and non-root-walking VCs, we get weird situations. For example, in
a CVS + GIT repo rooted at foo/, every folder under foo will have a
CVS folder, but only foo/ will have a .git folder. This means that
our only-get-the-most-specific-VCS heuristic is horribly broken when
invoked on foo/wibble/.
The 'fix' here is to simply not consider the depth of VCs that don't
root walk when deciding whether to clear our most-specific-VC list.
This is still broken for subversion because 1.6 doesn't root walk,
but 1.7 does, and they both look for the same directory. However,
it should ameliorate the problem for CVS users.
meld/vc/__init__.py | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/meld/vc/__init__.py b/meld/vc/__init__.py
index 5d7fec3..92a4da0 100644
--- a/meld/vc/__init__.py
+++ b/meld/vc/__init__.py
@@ -73,18 +73,21 @@ def get_vcs(location):
"""
vcs = []
- max_len = 0
+ max_depth = 0
for plugin in _plugins:
try:
- avc = plugin.Vc(location)
- l = len(avc.root)
- if l == max_len:
- vcs.append(avc)
- elif l > max_len:
- max_len = l
- vcs = [avc]
+ vc = plugin.Vc(location)
except ValueError:
- pass
+ continue
+
+ # 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)
if not vcs:
# No plugin recognized that location, fallback to _null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]