Browse files

To allow runtime config changes, vcs checker function moved back to g…

…et_vcs function.
  • Loading branch information...
1 parent 510cfdc commit cad7cc87f8fae49dd0e79bfd06049f18fac9661b @stdk stdk committed Jun 12, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 Modific.py
View
9 Modific.py
@@ -13,17 +13,16 @@
settings = sublime.load_settings("Modific.sublime-settings")
-#helper function to test for vcs existence in given folder
-#uses closure to lock cycle variable value inside lambda
-vcs_check = [ (lambda vcs: lambda dir: os.path.exists(os.path.join(dir,'.'+vcs))
- and {'root': dir, 'name': vcs}) (vcs)
- for vcs,_ in settings.get('vcs') ]
def get_vcs(directory):
"""
Determines, which of VCS systems we should use for given folder.
Currently, uses priority of definitions in settings.get('vcs')
"""
+ vcs_check = [ (lambda vcs: lambda dir: os.path.exists(os.path.join(dir,'.'+vcs))
+ and {'root': dir, 'name': vcs}) (vcs)
+ for vcs,_ in settings.get('vcs') ]
+
while directory:
available = filter(lambda x:x,[check(directory) for check in vcs_check])
if available: return available[0]

0 comments on commit cad7cc8

Please sign in to comment.