Show More
@@ -68,11 +68,12 b' class PullrequestsController(BaseRepoCon' | |||
|
68 | 68 | c.users_array = repo_model.get_users_js() |
|
69 | 69 | c.users_groups_array = repo_model.get_users_groups_js() |
|
70 | 70 | |
|
71 | def _get_repo_refs(self, repo, rev=None, branch_rev=None): | |
|
71 | def _get_repo_refs(self, repo, rev=None, branch=None, branch_rev=None): | |
|
72 | 72 | """return a structure with repo's interesting changesets, suitable for |
|
73 | 73 | the selectors in pullrequest.html |
|
74 | 74 | |
|
75 | rev: a revision that must be in the list and selected by default | |
|
75 | rev: a revision that must be in the list somehow and selected by default | |
|
76 | branch: a branch that must be in the list and selected by default - even if closed | |
|
76 | 77 | branch_rev: a revision of which peers should be preferred and available.""" |
|
77 | 78 | # list named branches that has been merged to this named branch - it should probably merge back |
|
78 | 79 | peers = [] |
@@ -80,6 +81,9 b' class PullrequestsController(BaseRepoCon' | |||
|
80 | 81 | if rev: |
|
81 | 82 | rev = safe_str(rev) |
|
82 | 83 | |
|
84 | if branch: | |
|
85 | branch = safe_str(branch) | |
|
86 | ||
|
83 | 87 | if branch_rev: |
|
84 | 88 | branch_rev = safe_str(branch_rev) |
|
85 | 89 | # not restricting to merge() would also get branch point and be better |
@@ -102,6 +106,15 b' class PullrequestsController(BaseRepoCon' | |||
|
102 | 106 | branches.append((n, abranch)) |
|
103 | 107 | if rev == branchrev: |
|
104 | 108 | selected = n |
|
109 | if branch == abranch: | |
|
110 | selected = n | |
|
111 | branch = None | |
|
112 | if branch: # branch not in list - it is probably closed | |
|
113 | revs = repo._repo.revs('max(branch(%s))', branch) | |
|
114 | if revs: | |
|
115 | cs = repo.get_changeset(revs[0]) | |
|
116 | selected = 'branch:%s:%s' % (branch, cs.raw_id) | |
|
117 | branches.append((selected, branch)) | |
|
105 | 118 | |
|
106 | 119 | bookmarks = [] |
|
107 | 120 | for bookmark, bookmarkrev in repo.bookmarks.iteritems(): |
@@ -252,11 +265,12 b' class PullrequestsController(BaseRepoCon' | |||
|
252 | 265 | # rev_start is not directly useful - its parent could however be used |
|
253 | 266 | # as default for other and thus give a simple compare view |
|
254 | 267 | #other_rev = request.POST.get('rev_start') |
|
268 | branch = request.GET.get('branch') | |
|
255 | 269 | |
|
256 | 270 | c.org_repos = [] |
|
257 | 271 | c.org_repos.append((org_repo.repo_name, org_repo.repo_name)) |
|
258 | 272 | c.default_org_repo = org_repo.repo_name |
|
259 | c.org_refs, c.default_org_ref = self._get_repo_refs(org_repo.scm_instance, org_rev) | |
|
273 | c.org_refs, c.default_org_ref = self._get_repo_refs(org_repo.scm_instance, rev=org_rev, branch=branch) | |
|
260 | 274 | |
|
261 | 275 | c.other_repos = [] |
|
262 | 276 | other_repos_info = {} |
@@ -149,7 +149,6 b'' | |||
|
149 | 149 | //ranges |
|
150 | 150 | var checkboxes = YUD.getElementsByClassName('changeset_range'); |
|
151 | 151 | var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}"; |
|
152 | var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}"; | |
|
153 | 152 | |
|
154 | 153 | var checkbox_checker = function(e){ |
|
155 | 154 | var checked_checkboxes = []; |
@@ -188,14 +187,17 b'' | |||
|
188 | 187 | YUD.setStyle('rev_range_container','display',''); |
|
189 | 188 | YUD.setStyle('rev_range_clear','display',''); |
|
190 | 189 | |
|
191 | YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end); | |
|
190 | var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name,rev_start='{0}',rev_end='{1}')}"; | |
|
191 | YUD.get('open_new_pr').href = pr_tmpl.format(rev_start,rev_end); | |
|
192 | 192 | YUD.setStyle('compare_fork','display','none'); |
|
193 | 193 | }else{ |
|
194 | 194 | YUD.setStyle('rev_range_container','display','none'); |
|
195 | 195 | YUD.setStyle('rev_range_clear','display','none'); |
|
196 |
if |
|
|
197 |
YUD.get('open_new_pr').href = |
|
|
198 |
|
|
|
196 | %if c.branch_name: | |
|
197 | YUD.get('open_new_pr').href = "${h.url('pullrequest_home',repo_name=c.repo_name,branch=c.branch_name)}"; | |
|
198 | %else: | |
|
199 | YUD.get('open_new_pr').href = "${h.url('pullrequest_home',repo_name=c.repo_name)}"; | |
|
200 | %endif | |
|
199 | 201 | YUD.setStyle('compare_fork','display',''); |
|
200 | 202 | } |
|
201 | 203 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now