Show More
@@ -71,26 +71,9 b' class PullrequestsController(BaseRepoCon' | |||
|
71 | 71 | def _get_repo_refs(self, repo, rev=None, branch_rev=None): |
|
72 | 72 | """return a structure with repo's interesting changesets, suitable for |
|
73 | 73 | the selectors in pullrequest.html""" |
|
74 | branches = [('branch:%s:%s' % (k, v), k) | |
|
75 | for k, v in repo.branches.iteritems()] | |
|
76 | bookmarks = [('book:%s:%s' % (k, v), k) | |
|
77 | for k, v in repo.bookmarks.iteritems()] | |
|
78 | tags = [('tag:%s:%s' % (k, v), k) | |
|
79 | for k, v in repo.tags.iteritems() | |
|
80 | if k != 'tip'] | |
|
81 | ||
|
82 | tip = repo.tags['tip'] | |
|
83 | colontip = ':' + tip | |
|
84 | tips = [x[1] for x in branches + bookmarks + tags | |
|
85 | if x[0].endswith(colontip)] | |
|
86 | selected = 'tag:tip:%s' % tip | |
|
87 | special = [(selected, 'tip: %s' % ', '.join(tips))] | |
|
88 | ||
|
89 | if rev: | |
|
90 | selected = 'rev:%s:%s' % (rev, rev) | |
|
91 | special.append((selected, '%s: %s' % (_("Selected"), rev[:12]))) | |
|
92 | 74 | |
|
93 | 75 | # list named branches that has been merged to this named branch - it should probably merge back |
|
76 | peers = [] | |
|
94 | 77 | if branch_rev: |
|
95 | 78 | # not restricting to merge() would also get branch point and be better |
|
96 | 79 | # (especially because it would get the branch point) ... but is currently too expensive |
@@ -102,13 +85,51 b' class PullrequestsController(BaseRepoCon' | |||
|
102 | 85 | otherbranches[cs.branch] = cs.raw_id |
|
103 | 86 | for branch, node in otherbranches.iteritems(): |
|
104 | 87 | selected = 'branch:%s:%s' % (branch, node) |
|
105 |
|
|
|
88 | peers.append((selected, branch)) | |
|
89 | ||
|
90 | selected = None | |
|
91 | branches = [] | |
|
92 | for branch, branchrev in repo.branches.iteritems(): | |
|
93 | n = 'branch:%s:%s' % (branch, branchrev) | |
|
94 | branches.append((n, branch)) | |
|
95 | if rev == branchrev: | |
|
96 | selected = n | |
|
97 | bookmarks = [] | |
|
98 | for bookmark, bookmarkrev in repo.bookmarks.iteritems(): | |
|
99 | n = 'book:%s:%s' % (bookmark, bookmarkrev) | |
|
100 | bookmarks.append((n, bookmark)) | |
|
101 | if rev == bookmarkrev: | |
|
102 | selected = n | |
|
103 | tags = [] | |
|
104 | for tag, tagrev in repo.tags.iteritems(): | |
|
105 | n = 'tag:%s:%s' % (tag, tagrev) | |
|
106 | tags.append((n, tag)) | |
|
107 | if rev == tagrev and tag != 'tip': # tip is not a real tag - and its branch is better | |
|
108 | selected = n | |
|
106 | 109 | |
|
107 | return [(special, _("Special")), | |
|
108 | (bookmarks, _("Bookmarks")), | |
|
109 | (branches, _("Branches")), | |
|
110 | (tags, _("Tags")), | |
|
111 |
|
|
|
110 | # prio 1: rev was selected as existing entry above | |
|
111 | ||
|
112 | # prio 2: create special entry for rev; rev _must_ be used | |
|
113 | specials = [] | |
|
114 | if rev and selected is None: | |
|
115 | selected = 'rev:%s:%s' % (rev, rev) | |
|
116 | specials = [(selected, '%s: %s' % (_("Changeset"), rev[:12]))] | |
|
117 | ||
|
118 | # prio 3: most recent peer branch | |
|
119 | if peers and not selected: | |
|
120 | selected = peers[0][0][0] | |
|
121 | ||
|
122 | # prio 4: tip revision | |
|
123 | if not selected: | |
|
124 | selected = 'tag:tip:%s' % repo.tags['tip'] | |
|
125 | ||
|
126 | groups = [(specials, _("Special")), | |
|
127 | (peers, _("Peer branches")), | |
|
128 | (bookmarks, _("Bookmarks")), | |
|
129 | (branches, _("Branches")), | |
|
130 | (tags, _("Tags")), | |
|
131 | ] | |
|
132 | return [g for g in groups if g[0]], selected | |
|
112 | 133 | |
|
113 | 134 | def _get_is_allowed_change_status(self, pull_request): |
|
114 | 135 | owner = self.rhodecode_user.user_id == pull_request.user_id |
General Comments 0
You need to be logged in to leave comments.
Login now