Show More
@@ -75,26 +75,21 b' class PullrequestsController(BaseRepoCon' | |||||
75 | bookmarks_group = ([('book:%s:%s' % (k, v), k) for |
|
75 | bookmarks_group = ([('book:%s:%s' % (k, v), k) for | |
76 | k, v in repo.bookmarks.iteritems()], _("Bookmarks")) |
|
76 | k, v in repo.bookmarks.iteritems()], _("Bookmarks")) | |
77 | tags_group = ([('tag:%s:%s' % (k, v), k) for |
|
77 | tags_group = ([('tag:%s:%s' % (k, v), k) for | |
78 |
k, v in repo.tags.iteritems() |
|
78 | k, v in repo.tags.iteritems() | |
|
79 | if k != 'tip'], _("Tags")) | |||
|
80 | ||||
|
81 | tip = repo.tags['tip'] | |||
|
82 | tipref = 'tag:tip:%s' % tip | |||
|
83 | colontip = ':' + tip | |||
|
84 | tips = [x[1] for x in branches_group[0] + bookmarks_group[0] + tags_group[0] | |||
|
85 | if x[0].endswith(colontip)] | |||
|
86 | tags_group[0].append((tipref, 'tip (%s)' % ', '.join(tips))) | |||
79 |
|
87 | |||
80 | hist_l.append(bookmarks_group) |
|
88 | hist_l.append(bookmarks_group) | |
81 | hist_l.append(branches_group) |
|
89 | hist_l.append(branches_group) | |
82 | hist_l.append(tags_group) |
|
90 | hist_l.append(tags_group) | |
83 |
|
91 | |||
84 | return hist_l |
|
92 | return hist_l, tipref | |
85 |
|
||||
86 | def _get_default_rev(self, repo): |
|
|||
87 | """ |
|
|||
88 | Get's default revision to do compare on pull request |
|
|||
89 |
|
||||
90 | :param repo: |
|
|||
91 | """ |
|
|||
92 | repo = repo.scm_instance |
|
|||
93 | if 'default' in repo.branches: |
|
|||
94 | return 'default' |
|
|||
95 | else: |
|
|||
96 | #if repo doesn't have default branch return first found |
|
|||
97 | return repo.branches.keys()[0] |
|
|||
98 |
|
93 | |||
99 | def _get_is_allowed_change_status(self, pull_request): |
|
94 | def _get_is_allowed_change_status(self, pull_request): | |
100 | owner = self.rhodecode_user.user_id == pull_request.user_id |
|
95 | owner = self.rhodecode_user.user_id == pull_request.user_id | |
@@ -128,18 +123,18 b' class PullrequestsController(BaseRepoCon' | |||||
128 | c.org_repos.append((org_repo.repo_name, '%s/%s' % ( |
|
123 | c.org_repos.append((org_repo.repo_name, '%s/%s' % ( | |
129 | org_repo.user.username, org_repo.repo_name)) |
|
124 | org_repo.user.username, org_repo.repo_name)) | |
130 | ) |
|
125 | ) | |
131 | c.org_refs = self._get_repo_refs(org_repo.scm_instance) |
|
126 | c.default_org_repo = org_repo.repo_name | |
|
127 | c.org_refs, c.default_org_ref = self._get_repo_refs(org_repo.scm_instance) | |||
132 |
|
128 | |||
133 | c.other_repos = [] |
|
129 | c.other_repos = [] | |
134 | # add org repo to other so we can open pull request against itself |
|
130 | # add org repo to other so we can open pull request against itself | |
135 | c.other_repos.extend(c.org_repos) |
|
131 | c.other_repos.extend(c.org_repos) | |
136 | c.default_other_repo = org_repo.repo_name |
|
132 | c.default_other_repo = org_repo.repo_name | |
137 | c.default_other_refs = self._get_repo_refs(org_repo.scm_instance) |
|
133 | c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.scm_instance) | |
138 | c.default_other_ref = self._get_default_rev(org_repo) |
|
|||
139 | other_repos_info[org_repo.repo_name] = { |
|
134 | other_repos_info[org_repo.repo_name] = { | |
140 | 'gravatar': h.gravatar_url(org_repo.user.email, 24), |
|
135 | 'gravatar': h.gravatar_url(org_repo.user.email, 24), | |
141 | 'description': org_repo.description, |
|
136 | 'description': org_repo.description, | |
142 |
'revs': h.select('other_ref', |
|
137 | 'revs': h.select('other_ref', c.default_other_ref, c.default_other_refs, class_='refs') | |
143 | } |
|
138 | } | |
144 |
|
139 | |||
145 | # gather forks and add to this list ... even though it is rare to request forks to pull their parent |
|
140 | # gather forks and add to this list ... even though it is rare to request forks to pull their parent | |
@@ -147,19 +142,17 b' class PullrequestsController(BaseRepoCon' | |||||
147 | c.other_repos.append((fork.repo_name, '%s/%s' % ( |
|
142 | c.other_repos.append((fork.repo_name, '%s/%s' % ( | |
148 | fork.user.username, fork.repo_name)) |
|
143 | fork.user.username, fork.repo_name)) | |
149 | ) |
|
144 | ) | |
|
145 | refs, default_ref = self._get_repo_refs(fork.scm_instance) | |||
150 | other_repos_info[fork.repo_name] = { |
|
146 | other_repos_info[fork.repo_name] = { | |
151 | 'gravatar': h.gravatar_url(fork.user.email, 24), |
|
147 | 'gravatar': h.gravatar_url(fork.user.email, 24), | |
152 | 'description': fork.description, |
|
148 | 'description': fork.description, | |
153 |
'revs': h.select('other_ref', '' |
|
149 | 'revs': h.select('other_ref', default_ref, refs, class_='refs') | |
154 | self._get_repo_refs(fork.scm_instance), |
|
|||
155 | class_='refs') |
|
|||
156 | } |
|
150 | } | |
157 |
|
151 | |||
158 | # add parents of this fork also, but only if it's not empty |
|
152 | # add parents of this fork also, but only if it's not empty | |
159 | if org_repo.parent and org_repo.parent.scm_instance.revisions: |
|
153 | if org_repo.parent and org_repo.parent.scm_instance.revisions: | |
160 | c.default_other_repo = org_repo.parent.repo_name |
|
154 | c.default_other_repo = org_repo.parent.repo_name | |
161 | c.default_other_refs = self._get_repo_refs(org_repo.parent.scm_instance) |
|
155 | c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.parent.scm_instance) | |
162 | c.default_other_ref = self._get_default_rev(org_repo.parent) |
|
|||
163 | c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % ( |
|
156 | c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % ( | |
164 | org_repo.parent.user.username, |
|
157 | org_repo.parent.user.username, | |
165 | org_repo.parent.repo_name)) |
|
158 | org_repo.parent.repo_name)) | |
@@ -167,9 +160,7 b' class PullrequestsController(BaseRepoCon' | |||||
167 | other_repos_info[org_repo.parent.repo_name] = { |
|
160 | other_repos_info[org_repo.parent.repo_name] = { | |
168 | 'gravatar': h.gravatar_url(org_repo.parent.user.email, 24), |
|
161 | 'gravatar': h.gravatar_url(org_repo.parent.user.email, 24), | |
169 | 'description': org_repo.parent.description, |
|
162 | 'description': org_repo.parent.description, | |
170 |
'revs': h.select('other_ref', '' |
|
163 | 'revs': h.select('other_ref', c.default_other_ref, c.default_other_refs, class_='refs') | |
171 | self._get_repo_refs(org_repo.parent.scm_instance), |
|
|||
172 | class_='refs') |
|
|||
173 | } |
|
164 | } | |
174 |
|
165 | |||
175 | c.other_repos_info = json.dumps(other_repos_info) |
|
166 | c.other_repos_info = json.dumps(other_repos_info) |
@@ -31,7 +31,7 b'' | |||||
31 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> |
|
31 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> | |
32 | </div> |
|
32 | </div> | |
33 | <span style="font-size: 20px"> |
|
33 | <span style="font-size: 20px"> | |
34 |
${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref', |
|
34 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')} | |
35 | </span> |
|
35 | </span> | |
36 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> |
|
36 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> | |
37 | </div> |
|
37 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now