def getRepos(client, path): logging.info('Scanning repos') response = client.propfind('/{}/'.format(path), depth=1) anchorStart, anchorEnd = makeHTMLTags('D:href') anchor = anchorStart + SkipTo(anchorEnd).setResultsName('body') + anchorEnd return [tokens.body for tokens in anchor.searchString(response.content) if '.git' in tokens.body]
def getGitRoot(path): pathWas = os.path.abspath(path) path = pathWas while os.path.sep in path: if os.path.exists(path+'/.git'): logging.info('Path changed to '+path) return path path = os.path.dirname(path).rstrip(os.path.sep) logging.warning('Cant find git repo, using current directory') return pathWas