##// END OF EJS Templates
Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
marcink -
r136:36102488 default
parent child Browse files
Show More
@@ -90,5 +90,17 b" def make_ui(path='hgwebdir.config', chec"
90
90
91 return baseui
91 return baseui
92
92
93 from vcs.backends.base import BaseChangeset
94 from vcs.utils.lazy import LazyProperty
95 class EmptyChangeset(BaseChangeset):
96
97 revision = -1
93
98
99 @LazyProperty
100 def raw_id(self):
101 """
102 Returns raw string identifing this changeset, useful for web
103 representation.
104 """
105 return '0' * 12
94
106
@@ -3,6 +3,7 b''
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
@@ -37,8 +38,12 b' class HgModel(object):'
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']
@@ -46,9 +51,9 b' class HgModel(object):'
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())
General Comments 0
You need to be logged in to leave comments. Login now