Mercurial > kallithea
changeset 8022:5b6174420e30
vcs: simplify get_scm
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 19 Dec 2019 23:24:29 +0100 |
parents | 082780404e6c |
children | 439b3aea3479 |
files | kallithea/lib/vcs/utils/helpers.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/utils/helpers.py Mon Dec 16 02:29:34 2019 +0100 +++ b/kallithea/lib/vcs/utils/helpers.py Thu Dec 19 23:24:29 2019 +0100 @@ -33,16 +33,14 @@ 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: