comparison rhodecode/controllers/pullrequests.py @ 2244:77e376fdc4c6 codereview

pull requests draft UI
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 08 May 2012 02:04:28 +0200
parents
children b262e349a7a5
comparison
equal deleted inserted replaced
2243:f6cdfc730831 2244:77e376fdc4c6
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.controllers.pullrequests
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 pull requests controller for rhodecode for initializing pull requests
7
8 :created_on: May 7, 2012
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
12 """
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import logging
26 import traceback
27
28 from pylons import request, response, session, tmpl_context as c, url
29 from pylons.controllers.util import abort, redirect
30 from pylons.i18n.translation import _
31
32 from rhodecode.lib.base import BaseRepoController, render
33 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
34 from webob.exc import HTTPNotFound
35
36 log = logging.getLogger(__name__)
37
38
39 class PullrequestsController(BaseRepoController):
40
41 @LoginRequired()
42 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
43 'repository.admin')
44 def __before__(self):
45 super(PullrequestsController, self).__before__()
46
47 def _get_repo_refs(self,repo):
48 hist_l = []
49
50 branches_group = ([(k, k) for k in repo.branches.keys()], _("Branches"))
51 bookmarks_group = ([(k, k) for k in repo.bookmarks.keys()], _("Bookmarks"))
52 tags_group = ([(k, k) for k in repo.tags.keys()], _("Tags"))
53
54 hist_l.append(bookmarks_group)
55 hist_l.append(branches_group)
56 hist_l.append(tags_group)
57
58 return hist_l
59
60 def index(self):
61 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
62 c.sources = []
63 c.sources.append('%s/%s' % (c.rhodecode_db_repo.user.username,
64 c.repo_name))
65 return render('/pullrequests/pullrequest.html')