##// END OF EJS Templates
reposcann should skip directories with starting with '.'...
marcink -
r3228:ba2e2514 beta
parent child Browse files
Show More
@@ -171,7 +171,7 b' def action_logger(user, action, repo, ip'
171 raise
171 raise
172
172
173
173
174 def get_repos(path, recursive=False):
174 def get_repos(path, recursive=False, skip_removed_repos=True):
175 """
175 """
176 Scans given path for repos and return (name,(type,path)) tuple
176 Scans given path for repos and return (name,(type,path)) tuple
177
177
@@ -181,6 +181,7 b' def get_repos(path, recursive=False):'
181
181
182 # remove ending slash for better results
182 # remove ending slash for better results
183 path = path.rstrip(os.sep)
183 path = path.rstrip(os.sep)
184 log.debug('now scanning in %s location recursive:%s...' % (path, recursive))
184
185
185 def _get_repos(p):
186 def _get_repos(p):
186 if not os.access(p, os.W_OK):
187 if not os.access(p, os.W_OK):
@@ -189,6 +190,15 b' def get_repos(path, recursive=False):'
189 if os.path.isfile(os.path.join(p, dirpath)):
190 if os.path.isfile(os.path.join(p, dirpath)):
190 continue
191 continue
191 cur_path = os.path.join(p, dirpath)
192 cur_path = os.path.join(p, dirpath)
193
194 # skip removed repos
195 if skip_removed_repos and REMOVED_REPO_PAT.match(dirpath):
196 continue
197
198 #skip .<somethin> dirs
199 if dirpath.startswith('.'):
200 continue
201
192 try:
202 try:
193 scm_info = get_scm(cur_path)
203 scm_info = get_scm(cur_path)
194 yield scm_info[1].split(path, 1)[-1].lstrip(os.sep), scm_info
204 yield scm_info[1].split(path, 1)[-1].lstrip(os.sep), scm_info
@@ -203,6 +213,9 b' def get_repos(path, recursive=False):'
203
213
204 return _get_repos(path)
214 return _get_repos(path)
205
215
216 #alias for backward compat
217 get_filesystem_repos = get_repos
218
206
219
207 def is_valid_repo(repo_name, base_path, scm=None):
220 def is_valid_repo(repo_name, base_path, scm=None):
208 """
221 """
@@ -80,7 +80,7 b' def get_scms_for_path(path):'
80 continue
80 continue
81 dirname = os.path.join(path, 'rm__.' + key)
81 dirname = os.path.join(path, 'rm__.' + key)
82 if os.path.isdir(dirname):
82 if os.path.isdir(dirname):
83 return [None]
83 return result
84 # We still need to check if it's not bare repository as
84 # We still need to check if it's not bare repository as
85 # bare repos don't have working directories
85 # bare repos don't have working directories
86 try:
86 try:
@@ -131,6 +131,7 b' def get_highlighted_code(name, code, typ'
131 content = code
131 content = code
132 return content
132 return content
133
133
134
134 def parse_changesets(text):
135 def parse_changesets(text):
135 """
136 """
136 Returns dictionary with *start*, *main* and *end* ids.
137 Returns dictionary with *start*, *main* and *end* ids.
@@ -46,7 +46,7 b' from rhodecode import BACKENDS'
46 from rhodecode.lib import helpers as h
46 from rhodecode.lib import helpers as h
47 from rhodecode.lib.utils2 import safe_str, safe_unicode
47 from rhodecode.lib.utils2 import safe_str, safe_unicode
48 from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny
48 from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny
49 from rhodecode.lib.utils import get_repos as get_filesystem_repos, make_ui, \
49 from rhodecode.lib.utils import get_filesystem_repos, make_ui, \
50 action_logger, REMOVED_REPO_PAT
50 action_logger, REMOVED_REPO_PAT
51 from rhodecode.model import BaseModel
51 from rhodecode.model import BaseModel
52 from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
52 from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
@@ -238,10 +238,6 b' class ScmModel(BaseModel):'
238 repos = {}
238 repos = {}
239
239
240 for name, path in get_filesystem_repos(repos_path, recursive=True):
240 for name, path in get_filesystem_repos(repos_path, recursive=True):
241 # skip removed repos
242 if REMOVED_REPO_PAT.match(name) or path[0] is None:
243 continue
244
245 # name need to be decomposed and put back together using the /
241 # name need to be decomposed and put back together using the /
246 # since this is internal storage separator for rhodecode
242 # since this is internal storage separator for rhodecode
247 name = Repository.normalize_repo_name(name)
243 name = Repository.normalize_repo_name(name)
@@ -261,7 +257,7 b' class ScmModel(BaseModel):'
261 repos[name] = klass(path[1])
257 repos[name] = klass(path[1])
262 except OSError:
258 except OSError:
263 continue
259 continue
264
260 log.debug('found %s paths with repositories' % (len(repos)))
265 return repos
261 return repos
266
262
267 def get_repos(self, all_repos=None, sort_key=None, simple=False):
263 def get_repos(self, all_repos=None, sort_key=None, simple=False):
General Comments 0
You need to be logged in to leave comments. Login now