Mercurial > public > src > rhodecode
diff 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 |
line wrap: on
line diff
--- a/pylons_app/lib/utils.py Wed Jul 14 15:42:39 2010 +0200 +++ b/pylons_app/lib/utils.py Wed Jul 14 16:51:19 2010 +0200 @@ -177,11 +177,10 @@ return '0' * 12 -def repo2db_mapper(initial_repo_list): +def repo2db_mapper(initial_repo_list, remove_obsolete=False): """ maps all found repositories into db """ - from pylons_app.model.meta import Session from pylons_app.model.repo_model import RepoModel sa = Session() @@ -200,3 +199,12 @@ 'private':False } rm.create(form_data, user, just_db=True) + + + if remove_obsolete: + #remove from database those repositories that are not in the filesystem + for repo in sa.query(Repository).all(): + if repo.repo_name not in initial_repo_list.keys(): + sa.delete(repo) + sa.commit() +