Changeset - 5b6174420e30
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 6 years ago 2019-12-19 23:24:29
mads@kiilerich.com
Grafted from: 9cbf06eec8a3
vcs: simplify get_scm
1 file changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/utils/helpers.py
Show inline comments
 
@@ -33,16 +33,14 @@ def get_scm(path, search_up=False, expli
 
    if not os.path.isdir(path):
 
        raise VCSError("Given path %s is not a directory" % path)
 

	
 
    def get_scms(path):
 
        return [(scm, path) for scm in get_scms_for_path(path)]
 

	
 
    found_scms = get_scms(path)
 
    while not found_scms and search_up:
 
    while True:
 
        found_scms = [(scm, path) for scm in get_scms_for_path(path)]
 
        if found_scms or not search_up:
 
            break
 
        newpath = abspath(path, '..')
 
        if newpath == path:
 
            break
 
        path = newpath
 
        found_scms = get_scms(path)
 

	
 
    if len(found_scms) > 1:
 
        for scm in found_scms:
0 comments (0 inline, 0 general)