Show More
@@ -52,6 +52,7 b' from rhodecode.model.repo import RepoMod' | |||||
52 | from rhodecode.model.comment import ChangesetCommentsModel |
|
52 | from rhodecode.model.comment import ChangesetCommentsModel | |
53 | from rhodecode.model.changeset_status import ChangesetStatusModel |
|
53 | from rhodecode.model.changeset_status import ChangesetStatusModel | |
54 | from rhodecode.model.forms import PullRequestForm |
|
54 | from rhodecode.model.forms import PullRequestForm | |
|
55 | from mercurial import scmutil | |||
55 |
|
56 | |||
56 | log = logging.getLogger(__name__) |
|
57 | log = logging.getLogger(__name__) | |
57 |
|
58 | |||
@@ -67,7 +68,7 b' class PullrequestsController(BaseRepoCon' | |||||
67 | c.users_array = repo_model.get_users_js() |
|
68 | c.users_array = repo_model.get_users_js() | |
68 | c.users_groups_array = repo_model.get_users_groups_js() |
|
69 | c.users_groups_array = repo_model.get_users_groups_js() | |
69 |
|
70 | |||
70 | def _get_repo_refs(self, repo, rev=None): |
|
71 | def _get_repo_refs(self, repo, rev=None, branch_rev=None): | |
71 | """return a structure with repo's interesting changesets, suitable for |
|
72 | """return a structure with repo's interesting changesets, suitable for | |
72 | the selectors in pullrequest.html""" |
|
73 | the selectors in pullrequest.html""" | |
73 | branches = [('branch:%s:%s' % (k, v), k) |
|
74 | branches = [('branch:%s:%s' % (k, v), k) | |
@@ -83,11 +84,25 b' class PullrequestsController(BaseRepoCon' | |||||
83 | tips = [x[1] for x in branches + bookmarks + tags |
|
84 | tips = [x[1] for x in branches + bookmarks + tags | |
84 | if x[0].endswith(colontip)] |
|
85 | if x[0].endswith(colontip)] | |
85 | selected = 'tag:tip:%s' % tip |
|
86 | selected = 'tag:tip:%s' % tip | |
86 |
special = [(selected, 'tip |
|
87 | special = [(selected, 'tip: %s' % ', '.join(tips))] | |
87 |
|
88 | |||
88 | if rev: |
|
89 | if rev: | |
89 | selected = 'rev:%s:%s' % (rev, rev) |
|
90 | selected = 'rev:%s:%s' % (rev, rev) | |
90 | special.append((selected, rev)) |
|
91 | special.append((selected, '%s: %s' % (_("Selected"), rev[:12]))) | |
|
92 | ||||
|
93 | # list named branches that has been merged to this named branch - it should probably merge back | |||
|
94 | if branch_rev: | |||
|
95 | # not restricting to merge() would also get branch point and be better | |||
|
96 | # (especially because it would get the branch point) ... but is currently too expensive | |||
|
97 | revs = ["sort(parents(branch(id('%s')) and merge()) - branch(id('%s')))" % | |||
|
98 | (branch_rev, branch_rev)] | |||
|
99 | otherbranches = {} | |||
|
100 | for i in scmutil.revrange(repo._repo, revs): | |||
|
101 | cs = repo.get_changeset(i) | |||
|
102 | otherbranches[cs.branch] = cs.raw_id | |||
|
103 | for branch, node in otherbranches.iteritems(): | |||
|
104 | selected = 'branch:%s:%s' % (branch, node) | |||
|
105 | special.append((selected, '%s: %s' % (_('Peer'), branch))) | |||
91 |
|
106 | |||
92 | return [(special, _("Special")), |
|
107 | return [(special, _("Special")), | |
93 | (bookmarks, _("Bookmarks")), |
|
108 | (bookmarks, _("Bookmarks")), | |
@@ -137,7 +152,7 b' class PullrequestsController(BaseRepoCon' | |||||
137 | # add org repo to other so we can open pull request against itself |
|
152 | # add org repo to other so we can open pull request against itself | |
138 | c.other_repos.extend(c.org_repos) |
|
153 | c.other_repos.extend(c.org_repos) | |
139 | c.default_other_repo = org_repo.repo_name |
|
154 | c.default_other_repo = org_repo.repo_name | |
140 | c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.scm_instance) |
|
155 | c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.scm_instance, branch_rev=org_rev) | |
141 | usr_data = lambda usr: dict(user_id=usr.user_id, |
|
156 | usr_data = lambda usr: dict(user_id=usr.user_id, | |
142 | username=usr.username, |
|
157 | username=usr.username, | |
143 | firstname=usr.firstname, |
|
158 | firstname=usr.firstname, |
General Comments 0
You need to be logged in to leave comments.
Login now