Mercurial > kallithea
comparison pylons_app/model/hg_model.py @ 303:3a66e7421a99
db model fix, added repo instance to cached repos list
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 28 Jun 2010 21:42:06 +0200 |
parents | cd2ee462fc2c |
children | d8d471cfa093 |
comparison
equal
deleted
inserted
replaced
302:779dabcaae28 | 303:3a66e7421a99 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # encoding: utf-8 | 2 # encoding: utf-8 |
3 # Model for hg app | 3 # Model for hg app |
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
5 from sqlalchemy.orm import joinedload | |
5 | 6 |
6 # This program is free software; you can redistribute it and/or | 7 # This program is free software; you can redistribute it and/or |
7 # modify it under the terms of the GNU General Public License | 8 # modify it under the terms of the GNU General Public License |
8 # as published by the Free Software Foundation; version 2 | 9 # as published by the Free Software Foundation; version 2 |
9 # of the License or (at your opinion) any later version of the license. | 10 # of the License or (at your opinion) any later version of the license. |
114 | 115 |
115 repos_list[name] = MercurialRepository(path, baseui=baseui) | 116 repos_list[name] = MercurialRepository(path, baseui=baseui) |
116 repos_list[name].name = name | 117 repos_list[name].name = name |
117 dbrepo = sa.query(Repository).get(name) | 118 dbrepo = sa.query(Repository).get(name) |
118 if dbrepo: | 119 if dbrepo: |
120 repos_list[name].dbrepo = dbrepo | |
119 repos_list[name].description = dbrepo.description | 121 repos_list[name].description = dbrepo.description |
120 repos_list[name].contact = dbrepo.user.full_contact | 122 repos_list[name].contact = dbrepo.user.full_contact |
121 except OSError: | 123 except OSError: |
122 continue | 124 continue |
123 return repos_list | 125 return repos_list |
147 tmp_d['rev'] = tip.revision | 149 tmp_d['rev'] = tip.revision |
148 tmp_d['contact'] = repo.contact | 150 tmp_d['contact'] = repo.contact |
149 tmp_d['contact_sort'] = tmp_d['contact'] | 151 tmp_d['contact_sort'] = tmp_d['contact'] |
150 tmp_d['repo_archives'] = list(repo._get_archives()) | 152 tmp_d['repo_archives'] = list(repo._get_archives()) |
151 tmp_d['last_msg'] = tip.message | 153 tmp_d['last_msg'] = tip.message |
152 | 154 tmp_d['repo'] = repo |
153 yield tmp_d | 155 yield tmp_d |
154 | 156 |
155 def get_repo(self, repo_name): | 157 def get_repo(self, repo_name): |
156 return _get_repos_cached()[repo_name] | 158 return _get_repos_cached()[repo_name] |