Mercurial > kallithea
comparison pylons_app/model/hg_model.py @ 136:36102488d634
Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 09 May 2010 14:13:20 +0200 |
parents | a214462101d2 |
children | 7109d15c6813 |
comparison
equal
deleted
inserted
replaced
135:28f28d423268 | 136:36102488d634 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # encoding: utf-8 | 2 # encoding: utf-8 |
3 # | 3 # |
4 # Copyright (c) 2010 marcink. All rights reserved. | 4 # Copyright (c) 2010 marcink. All rights reserved. |
5 # | 5 # |
6 from vcs.exceptions import RepositoryError | |
6 ''' | 7 ''' |
7 Created on Apr 9, 2010 | 8 Created on Apr 9, 2010 |
8 | 9 |
9 @author: marcink | 10 @author: marcink |
10 ''' | 11 ''' |
35 if mercurial_repo._get_hidden(): | 36 if mercurial_repo._get_hidden(): |
36 #skip hidden web repository | 37 #skip hidden web repository |
37 continue | 38 continue |
38 | 39 |
39 last_change = mercurial_repo.last_change | 40 last_change = mercurial_repo.last_change |
40 tip_rev = mercurial_repo._get_revision('tip') | 41 try: |
41 tip = mercurial_repo.get_changeset(tip_rev) | 42 tip = mercurial_repo.get_changeset('tip') |
43 except RepositoryError: | |
44 from pylons_app.lib.utils import EmptyChangeset | |
45 tip = EmptyChangeset() | |
46 | |
42 tmp_d = {} | 47 tmp_d = {} |
43 tmp_d['name'] = mercurial_repo.name | 48 tmp_d['name'] = mercurial_repo.name |
44 tmp_d['name_sort'] = tmp_d['name'] | 49 tmp_d['name_sort'] = tmp_d['name'] |
45 tmp_d['description'] = mercurial_repo.description | 50 tmp_d['description'] = mercurial_repo.description |
46 tmp_d['description_sort'] = tmp_d['description'] | 51 tmp_d['description_sort'] = tmp_d['description'] |
47 tmp_d['last_change'] = last_change | 52 tmp_d['last_change'] = last_change |
48 tmp_d['last_change_sort'] = last_change[1] - last_change[0] | 53 tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
49 tmp_d['tip'] = tip._short | 54 tmp_d['tip'] = tip.raw_id |
50 tmp_d['tip_sort'] = tip_rev | 55 tmp_d['tip_sort'] = tip.revision |
51 tmp_d['rev'] = tip_rev | 56 tmp_d['rev'] = tip.revision |
52 tmp_d['contact'] = mercurial_repo.contact | 57 tmp_d['contact'] = mercurial_repo.contact |
53 tmp_d['contact_sort'] = tmp_d['contact'] | 58 tmp_d['contact_sort'] = tmp_d['contact'] |
54 tmp_d['repo_archives'] = list(mercurial_repo._get_archives()) | 59 tmp_d['repo_archives'] = list(mercurial_repo._get_archives()) |
55 | 60 |
56 yield tmp_d | 61 yield tmp_d |