##// END OF EJS Templates
pull request: move code around and rename default variables
Mads Kiilerich -
r3327:f285faa3 beta
parent child Browse files
Show More
@@ -124,27 +124,25 class PullrequestsController(BaseRepoCon
124
124
125 other_repos_info = {}
125 other_repos_info = {}
126
126
127 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
128 c.org_repos = []
127 c.org_repos = []
129 c.other_repos = []
130 c.org_repos.append((org_repo.repo_name, '%s/%s' % (
128 c.org_repos.append((org_repo.repo_name, '%s/%s' % (
131 org_repo.user.username, c.repo_name))
129 org_repo.user.username, c.repo_name))
132 )
130 )
133
131 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
134 # add org repo to other so we can open pull request agains itself
135 c.other_repos.extend(c.org_repos)
136
132
137 c.default_pull_request = org_repo.repo_name # repo name pre-selected
133 c.other_repos = []
138 c.default_pull_request_rev = self._get_default_rev(org_repo) # revision pre-selected
134 # add org repo to other so we can open pull request against itself
139 c.default_revs = self._get_repo_refs(org_repo.scm_instance)
135 c.other_repos.extend(c.org_repos)
140 #add orginal repo
136 c.default_other_repo = org_repo.repo_name
137 c.default_other_refs = self._get_repo_refs(org_repo.scm_instance)
138 c.default_other_ref = self._get_default_rev(org_repo)
141 other_repos_info[org_repo.repo_name] = {
139 other_repos_info[org_repo.repo_name] = {
142 'gravatar': h.gravatar_url(org_repo.user.email, 24),
140 'gravatar': h.gravatar_url(org_repo.user.email, 24),
143 'description': org_repo.description,
141 'description': org_repo.description,
144 'revs': h.select('other_ref', '', c.default_revs, class_='refs')
142 'revs': h.select('other_ref', '', c.default_other_refs, class_='refs')
145 }
143 }
146
144
147 #gather forks and add to this list
145 # gather forks and add to this list ... even though it is rare to request forks to pull their parent
148 for fork in org_repo.forks:
146 for fork in org_repo.forks:
149 c.other_repos.append((fork.repo_name, '%s/%s' % (
147 c.other_repos.append((fork.repo_name, '%s/%s' % (
150 fork.user.username, fork.repo_name))
148 fork.user.username, fork.repo_name))
@@ -156,11 +154,12 class PullrequestsController(BaseRepoCon
156 self._get_repo_refs(fork.scm_instance),
154 self._get_repo_refs(fork.scm_instance),
157 class_='refs')
155 class_='refs')
158 }
156 }
159 #add parents of this fork also, but only if it's not empty
157
158 # add parents of this fork also, but only if it's not empty
160 if org_repo.parent and org_repo.parent.scm_instance.revisions:
159 if org_repo.parent and org_repo.parent.scm_instance.revisions:
161 c.default_pull_request = org_repo.parent.repo_name
160 c.default_other_repo = org_repo.parent.repo_name
162 c.default_pull_request_rev = self._get_default_rev(org_repo.parent)
161 c.default_other_refs = self._get_repo_refs(org_repo.parent.scm_instance)
163 c.default_revs = self._get_repo_refs(org_repo.parent.scm_instance)
162 c.default_other_ref = self._get_default_rev(org_repo.parent)
164 c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
163 c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
165 org_repo.parent.user.username,
164 org_repo.parent.user.username,
166 org_repo.parent.repo_name))
165 org_repo.parent.repo_name))
@@ -48,7 +48,7
48 <img id="other_repo_gravatar" alt="gravatar" src=""/>
48 <img id="other_repo_gravatar" alt="gravatar" src=""/>
49 </div>
49 </div>
50 <span style="font-size: 20px">
50 <span style="font-size: 20px">
51 ${h.select('other_repo',c.default_pull_request,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_pull_request_rev,c.default_revs,class_='refs')}
51 ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_other_ref,c.default_other_refs,class_='refs')}
52 </span>
52 </span>
53 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
53 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
54 </div>
54 </div>
General Comments 0
You need to be logged in to leave comments. Login now