annotate pylons_app/lib/utils.py @ 248:fb7f066126cc

Added support for repository located in subdirectories.
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 03 Jun 2010 20:28:46 +0200
parents a83a1799480c
children 3782a6d698af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
1 import os
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
2 import logging
125
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
3 from mercurial import ui, config, hg
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
4 from mercurial.error import RepoError
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
5 log = logging.getLogger(__name__)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
6
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
7
82
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
8 def get_repo_slug(request):
248
fb7f066126cc Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
9 return request.environ['pylons.routes_dict'].get('repo_name')
96
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
10
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
11 def is_mercurial(environ):
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
12 """
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
13 Returns True if request's target is mercurial server - header
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
14 ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``.
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
15 """
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
16 http_accept = environ.get('HTTP_ACCEPT')
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
17 if http_accept and http_accept.startswith('application/mercurial'):
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
18 return True
f24b9a2934cf added is mercurial method in utils,
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
19 return False
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
20
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
21 def check_repo_dir(paths):
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
22 repos_path = paths[0][1].split('/')
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
23 if repos_path[-1] in ['*', '**']:
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
24 repos_path = repos_path[:-1]
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
25 if repos_path[0] != '/':
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
26 repos_path[0] = '/'
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
27 if not os.path.isdir(os.path.join(*repos_path)):
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
28 raise Exception('Not a valid repository in %s' % paths[0][1])
125
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
29
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
30 def check_repo(repo_name, base_path):
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
31
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
32 repo_path = os.path.join(base_path, repo_name)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
33
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
34 try:
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
35 r = hg.repository(ui.ui(), repo_path)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
36 hg.verify(r)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
37 #here we hnow that repo exists it was verified
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
38 log.info('%s repo is already created', repo_name)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
39 return False
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
40 #raise Exception('Repo exists')
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
41 except RepoError:
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
42 log.info('%s repo is free for creation', repo_name)
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
43 #it means that there is no valid repo there...
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
44 return True
2811259dc12d Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
Marcin Kuzminski <marcin@python-works.com>
parents: 114
diff changeset
45
241
48727add84c9 Made repos path config configurable from pylons app configs. update Readme
Marcin Kuzminski <marcin@python-works.com>
parents: 197
diff changeset
46 def make_ui(path=None, checkpaths=True):
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
47 """
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
48 A funcion that will read python rc files and make an ui from read options
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
49
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
50 @param path: path to mercurial config file
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
51 """
241
48727add84c9 Made repos path config configurable from pylons app configs. update Readme
Marcin Kuzminski <marcin@python-works.com>
parents: 197
diff changeset
52 if not path:
48727add84c9 Made repos path config configurable from pylons app configs. update Readme
Marcin Kuzminski <marcin@python-works.com>
parents: 197
diff changeset
53 log.error('repos config path is empty !')
48727add84c9 Made repos path config configurable from pylons app configs. update Readme
Marcin Kuzminski <marcin@python-works.com>
parents: 197
diff changeset
54
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
55 if not os.path.isfile(path):
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 171
diff changeset
56 log.warning('Unable to read config file %s' % path)
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
57 return False
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
58 #propagated from mercurial documentation
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
59 sections = [
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
60 'alias',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
61 'auth',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
62 'decode/encode',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
63 'defaults',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
64 'diff',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
65 'email',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
66 'extensions',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
67 'format',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
68 'merge-patterns',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
69 'merge-tools',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
70 'hooks',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
71 'http_proxy',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
72 'smtp',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
73 'patch',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
74 'paths',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
75 'profiling',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
76 'server',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
77 'trusted',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
78 'ui',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
79 'web',
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
80 ]
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
81
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
82 baseui = ui.ui()
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
83 cfg = config.config()
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
84 cfg.read(path)
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
85 if checkpaths:check_repo_dir(cfg.items('paths'))
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
86
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
87 for section in sections:
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
88 for k, v in cfg.items(section):
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
89 baseui.setconfig(section, k, v)
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
90
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
91 return baseui
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
92
171
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
93 def invalidate_cache(name, *args):
194
3d1dd13887f9 invalidate the repo list also for online changes. Small fixes in LoginRequired decorator.
Marcin Kuzminski <marcin@python-works.com>
parents: 193
diff changeset
94 """Invalidates given name cache"""
3d1dd13887f9 invalidate the repo list also for online changes. Small fixes in LoginRequired decorator.
Marcin Kuzminski <marcin@python-works.com>
parents: 193
diff changeset
95
140
b5e59e2b5cfe moved cache invalidating to utils, as seperate function. Implemented invalidating in
Marcin Kuzminski <marcin@python-works.com>
parents: 136
diff changeset
96 from beaker.cache import region_invalidate
171
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
97 log.info('INVALIDATING CACHE FOR %s', name)
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
98
194
3d1dd13887f9 invalidate the repo list also for online changes. Small fixes in LoginRequired decorator.
Marcin Kuzminski <marcin@python-works.com>
parents: 193
diff changeset
99 """propagate our arguments to make sure invalidation works. First
171
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
100 argument has to be the name of cached func name give to cache decorator
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
101 without that the invalidation would not work"""
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
102 tmp = [name]
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
103 tmp.extend(args)
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
104 args = tuple(tmp)
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
105
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
106 if name == 'cached_repo_list':
245
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
107 from pylons_app.model.hg_model import _get_repos_cached
171
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
108 region_invalidate(_get_repos_cached, None, *args)
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
109
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
110 if name == 'full_changelog':
245
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
111 from pylons_app.model.hg_model import _full_changelog_cached
171
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
112 region_invalidate(_full_changelog_cached, None, *args)
52bbeb1e813f Added universal cache invalidator for two cached functions.
Marcin Kuzminski <marcin@python-works.com>
parents: 140
diff changeset
113
136
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
114 from vcs.backends.base import BaseChangeset
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
115 from vcs.utils.lazy import LazyProperty
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
116 class EmptyChangeset(BaseChangeset):
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
117
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
118 revision = -1
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
119
136
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
120 @LazyProperty
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
121 def raw_id(self):
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
122 """
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
123 Returns raw string identifing this changeset, useful for web
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
124 representation.
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
125 """
36102488d634 Added empty changeset to use in newly created repository, and used this inside a hg model in repos list
Marcin Kuzminski <marcin@python-works.com>
parents: 125
diff changeset
126 return '0' * 12
114
cc5cf1a93902 Implemented simplehg middleware,moved make_ui functions to lib.utils
Marcin Kuzminski <marcin@python-works.com>
parents: 96
diff changeset
127
245
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
128
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
129 def repo2db_mapper():
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
130 """
248
fb7f066126cc Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
131 scann all dirs for .hgdbid
fb7f066126cc Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
132 if some dir doesn't have one generate one.
245
a83a1799480c Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 241
diff changeset
133 """
248
fb7f066126cc Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
134 pass