Mercurial > kallithea
comparison rhodecode/controllers/branches.py @ 1045:3fc9183e05dd beta
another major codes rewrite:
- created BaseRepo controller for all repo specific controller, and added common data propagation
- removed obosete codes, and made optimizations, removed to often calls to RepoModel
- fixed found bugs in files controller that generated unhandled 500 errors
- cache issues
- removed repo_branches global template values
- journal fixes
- main repo list is fully dict now it's less resource heavy that way
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 15 Feb 2011 01:36:07 +0100 |
parents | 5554aa9c2480 |
children | 6832ef664673 |
comparison
equal
deleted
inserted
replaced
1044:f3402cb92fdf | 1045:3fc9183e05dd |
---|---|
28 import logging | 28 import logging |
29 | 29 |
30 from pylons import tmpl_context as c | 30 from pylons import tmpl_context as c |
31 | 31 |
32 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | 32 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
33 from rhodecode.lib.base import BaseController, render | 33 from rhodecode.lib.base import BaseRepoController, render |
34 from rhodecode.lib.utils import OrderedDict | 34 from rhodecode.lib.utils import OrderedDict |
35 from rhodecode.model.scm import ScmModel | |
36 | 35 |
37 log = logging.getLogger(__name__) | 36 log = logging.getLogger(__name__) |
38 | 37 |
39 class BranchesController(BaseController): | 38 class BranchesController(BaseRepoController): |
40 | 39 |
41 @LoginRequired() | 40 @LoginRequired() |
42 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | 41 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
43 'repository.admin') | 42 'repository.admin') |
44 def __before__(self): | 43 def __before__(self): |
45 super(BranchesController, self).__before__() | 44 super(BranchesController, self).__before__() |
46 | 45 |
47 def index(self): | 46 def index(self): |
48 c.repo_info, dbrepo = ScmModel().get(c.repo_name, retval='repo') | 47 |
49 c.repo_branches = OrderedDict() | 48 c.repo_branches = OrderedDict() |
50 for name, hash_ in c.repo_info.branches.items(): | 49 for name, hash_ in c.rhodecode_repo.branches.items(): |
51 c.repo_branches[name] = c.repo_info.get_changeset(hash_) | 50 c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash_) |
52 | 51 |
53 return render('branches/branches.html') | 52 return render('branches/branches.html') |