Mercurial > public > src > rhodecode
comparison pylons_app/lib/utils.py @ 372:e8fc875467bd
implemented manual repo rescann and remapping
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 14 Jul 2010 16:51:19 +0200 |
parents | bb8f45f6d8f9 |
children | 664a5b8c551a |
comparison
equal
deleted
inserted
replaced
370:40bccabf4574 | 372:e8fc875467bd |
---|---|
175 representation. | 175 representation. |
176 """ | 176 """ |
177 return '0' * 12 | 177 return '0' * 12 |
178 | 178 |
179 | 179 |
180 def repo2db_mapper(initial_repo_list): | 180 def repo2db_mapper(initial_repo_list, remove_obsolete=False): |
181 """ | 181 """ |
182 maps all found repositories into db | 182 maps all found repositories into db |
183 """ | 183 """ |
184 from pylons_app.model.meta import Session | |
185 from pylons_app.model.repo_model import RepoModel | 184 from pylons_app.model.repo_model import RepoModel |
186 | 185 |
187 sa = Session() | 186 sa = Session() |
188 user = sa.query(User).filter(User.admin == True).first() | 187 user = sa.query(User).filter(User.admin == True).first() |
189 | 188 |
198 'description':repo.description if repo.description != 'unknown' else \ | 197 'description':repo.description if repo.description != 'unknown' else \ |
199 'auto description for %s' % name, | 198 'auto description for %s' % name, |
200 'private':False | 199 'private':False |
201 } | 200 } |
202 rm.create(form_data, user, just_db=True) | 201 rm.create(form_data, user, just_db=True) |
202 | |
203 | |
204 if remove_obsolete: | |
205 #remove from database those repositories that are not in the filesystem | |
206 for repo in sa.query(Repository).all(): | |
207 if repo.repo_name not in initial_repo_list.keys(): | |
208 sa.delete(repo) | |
209 sa.commit() | |
210 |