Show More
@@ -171,7 +171,7 b' def action_logger(user, action, repo, ip' | |||
|
171 | 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 | 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 | 182 | # remove ending slash for better results |
|
183 | 183 | path = path.rstrip(os.sep) |
|
184 | log.debug('now scanning in %s location recursive:%s...' % (path, recursive)) | |
|
184 | 185 | |
|
185 | 186 | def _get_repos(p): |
|
186 | 187 | if not os.access(p, os.W_OK): |
@@ -189,6 +190,15 b' def get_repos(path, recursive=False):' | |||
|
189 | 190 | if os.path.isfile(os.path.join(p, dirpath)): |
|
190 | 191 | continue |
|
191 | 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 | 202 | try: |
|
193 | 203 | scm_info = get_scm(cur_path) |
|
194 | 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 | 214 | return _get_repos(path) |
|
205 | 215 | |
|
216 | #alias for backward compat | |
|
217 | get_filesystem_repos = get_repos | |
|
218 | ||
|
206 | 219 | |
|
207 | 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 | 80 | continue |
|
81 | 81 | dirname = os.path.join(path, 'rm__.' + key) |
|
82 | 82 | if os.path.isdir(dirname): |
|
83 |
return |
|
|
83 | return result | |
|
84 | 84 | # We still need to check if it's not bare repository as |
|
85 | 85 | # bare repos don't have working directories |
|
86 | 86 | try: |
@@ -131,6 +131,7 b' def get_highlighted_code(name, code, typ' | |||
|
131 | 131 | content = code |
|
132 | 132 | return content |
|
133 | 133 | |
|
134 | ||
|
134 | 135 | def parse_changesets(text): |
|
135 | 136 | """ |
|
136 | 137 | Returns dictionary with *start*, *main* and *end* ids. |
@@ -46,7 +46,7 b' from rhodecode import BACKENDS' | |||
|
46 | 46 | from rhodecode.lib import helpers as h |
|
47 | 47 | from rhodecode.lib.utils2 import safe_str, safe_unicode |
|
48 | 48 | from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny |
|
49 |
from rhodecode.lib.utils import |
|
|
49 | from rhodecode.lib.utils import get_filesystem_repos, make_ui, \ | |
|
50 | 50 | action_logger, REMOVED_REPO_PAT |
|
51 | 51 | from rhodecode.model import BaseModel |
|
52 | 52 | from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \ |
@@ -238,10 +238,6 b' class ScmModel(BaseModel):' | |||
|
238 | 238 | repos = {} |
|
239 | 239 | |
|
240 | 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 | 241 | # name need to be decomposed and put back together using the / |
|
246 | 242 | # since this is internal storage separator for rhodecode |
|
247 | 243 | name = Repository.normalize_repo_name(name) |
@@ -261,7 +257,7 b' class ScmModel(BaseModel):' | |||
|
261 | 257 | repos[name] = klass(path[1]) |
|
262 | 258 | except OSError: |
|
263 | 259 | continue |
|
264 | ||
|
260 | log.debug('found %s paths with repositories' % (len(repos))) | |
|
265 | 261 | return repos |
|
266 | 262 | |
|
267 | 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