##// END OF EJS Templates
pullrequests: refactor changeset selectors, tip is special and not a real tag
Mads Kiilerich -
r3444:c12603d5 beta
parent child Browse files
Show More
@@ -67,29 +67,33 b' class PullrequestsController(BaseRepoCon'
67 67 c.users_array = repo_model.get_users_js()
68 68 c.users_groups_array = repo_model.get_users_groups_js()
69 69
70 def _get_repo_refs(self, repo):
71 hist_l = []
72
73 branches_group = ([('branch:%s:%s' % (k, v), k) for
74 k, v in repo.branches.iteritems()], _("Branches"))
75 bookmarks_group = ([('book:%s:%s' % (k, v), k) for
76 k, v in repo.bookmarks.iteritems()], _("Bookmarks"))
77 tags_group = ([('tag:%s:%s' % (k, v), k) for
78 k, v in repo.tags.iteritems()
79 if k != 'tip'], _("Tags"))
70 def _get_repo_refs(self, repo, rev=None):
71 """return a structure with repo's interesting changesets, suitable for
72 the selectors in pullrequest.html"""
73 branches = [('branch:%s:%s' % (k, v), k)
74 for k, v in repo.branches.iteritems()]
75 bookmarks = [('book:%s:%s' % (k, v), k)
76 for k, v in repo.bookmarks.iteritems()]
77 tags = [('tag:%s:%s' % (k, v), k)
78 for k, v in repo.tags.iteritems()
79 if k != 'tip']
80 80
81 81 tip = repo.tags['tip']
82 tipref = 'tag:tip:%s' % tip
83 82 colontip = ':' + tip
84 tips = [x[1] for x in branches_group[0] + bookmarks_group[0] + tags_group[0]
83 tips = [x[1] for x in branches + bookmarks + tags
85 84 if x[0].endswith(colontip)]
86 tags_group[0].append((tipref, 'tip (%s)' % ', '.join(tips)))
85 selected = 'tag:tip:%s' % tip
86 special = [(selected, 'tip (%s)' % ', '.join(tips))]
87 87
88 hist_l.append(bookmarks_group)
89 hist_l.append(branches_group)
90 hist_l.append(tags_group)
88 if rev:
89 selected = 'rev:%s:%s' % (rev, rev)
90 special.append((selected, rev))
91 91
92 return hist_l, tipref
92 return [(special, _("Special")),
93 (bookmarks, _("Bookmarks")),
94 (branches, _("Branches")),
95 (tags, _("Tags")),
96 ], selected
93 97
94 98 def _get_is_allowed_change_status(self, pull_request):
95 99 owner = self.rhodecode_user.user_id == pull_request.user_id
General Comments 0
You need to be logged in to leave comments. Login now