@@ -144,49 +144,49 @@ def action_logger(user, action, repo, ip
log.error(traceback.format_exc())
sa.rollback()
def get_repos(path, recursive=False):
"""
Scans given path for repos and return (name,(type,path)) tuple
:param path: path to scann for repositories
:param recursive: recursive search and return names with subdirs in front
from vcs.utils.helpers import get_scm
from vcs.exceptions import VCSError
if path.endswith('/'):
#add ending slash for better results
path = path[:-1]
def _get_repos(p):
for dirpath in os.listdir(p):
if os.path.isfile(os.path.join(p, dirpath)):
continue
cur_path = os.path.join(p, dirpath)
try:
scm_info = get_scm(cur_path)
yield scm_info[1].split(path)[-1].lstrip('/'), scm_info
yield scm_info[1].split(path)[-1].lstrip(os.sep), scm_info
except VCSError:
if not recursive:
#check if this dir containts other repos for recursive scan
rec_path = os.path.join(p, dirpath)
if os.path.isdir(rec_path):
for inner_scm in _get_repos(rec_path):
yield inner_scm
return _get_repos(path)
def check_repo_fast(repo_name, base_path):
Check given path for existence of directory
:param repo_name:
:param base_path:
:return False: if this directory is present
if os.path.isdir(os.path.join(base_path, repo_name)):return False
return True
def check_repo(repo_name, base_path, verify=True):
Status change: