##// END OF EJS Templates
pullrequest selection list: emphasize named branches that are neighbours
Mads Kiilerich -
r3515:5b3313a5 beta
parent child Browse files
Show More
@@ -52,6 +52,7 b' from rhodecode.model.repo import RepoMod'
52 52 from rhodecode.model.comment import ChangesetCommentsModel
53 53 from rhodecode.model.changeset_status import ChangesetStatusModel
54 54 from rhodecode.model.forms import PullRequestForm
55 from mercurial import scmutil
55 56
56 57 log = logging.getLogger(__name__)
57 58
@@ -67,7 +68,7 b' class PullrequestsController(BaseRepoCon'
67 68 c.users_array = repo_model.get_users_js()
68 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 72 """return a structure with repo's interesting changesets, suitable for
72 73 the selectors in pullrequest.html"""
73 74 branches = [('branch:%s:%s' % (k, v), k)
@@ -83,11 +84,25 b' class PullrequestsController(BaseRepoCon'
83 84 tips = [x[1] for x in branches + bookmarks + tags
84 85 if x[0].endswith(colontip)]
85 86 selected = 'tag:tip:%s' % tip
86 special = [(selected, 'tip (%s)' % ', '.join(tips))]
87 special = [(selected, 'tip: %s' % ', '.join(tips))]
87 88
88 89 if rev:
89 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 107 return [(special, _("Special")),
93 108 (bookmarks, _("Bookmarks")),
@@ -137,7 +152,7 b' class PullrequestsController(BaseRepoCon'
137 152 # add org repo to other so we can open pull request against itself
138 153 c.other_repos.extend(c.org_repos)
139 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 156 usr_data = lambda usr: dict(user_id=usr.user_id,
142 157 username=usr.username,
143 158 firstname=usr.firstname,
General Comments 0
You need to be logged in to leave comments. Login now