##// END OF EJS Templates
api: Include merge reference into API data of a PR.
Martin Bornhold -
r1054:122c7b13 default
parent child Browse files
Show More
@@ -96,8 +96,14 b' def get_pull_request(request, apiuser, r'
96 "commit_id": "<commit_id>",
96 "commit_id": "<commit_id>",
97 }
97 }
98 },
98 },
99 "shadow": {
99 "merge": {
100 "clone_url": "<clone_url>",
100 "clone_url": "<clone_url>",
101 "reference":
102 {
103 "name": "<name>",
104 "type": "<type>",
105 "commit_id": "<commit_id>",
106 }
101 },
107 },
102 "author": <user_obj>,
108 "author": <user_obj>,
103 "reviewers": [
109 "reviewers": [
@@ -181,8 +187,14 b' def get_pull_requests(request, apiuser, '
181 "commit_id": "<commit_id>",
187 "commit_id": "<commit_id>",
182 }
188 }
183 },
189 },
184 "shadow": {
190 "merge": {
185 "clone_url": "<clone_url>",
191 "clone_url": "<clone_url>",
192 "reference":
193 {
194 "name": "<name>",
195 "type": "<type>",
196 "commit_id": "<commit_id>",
197 }
186 },
198 },
187 "author": <user_obj>,
199 "author": <user_obj>,
188 "reviewers": [
200 "reviewers": [
@@ -3137,9 +3137,18 b' class PullRequest(Base, _PullRequestBase'
3137 from rhodecode.model.pull_request import PullRequestModel
3137 from rhodecode.model.pull_request import PullRequestModel
3138 pull_request = self
3138 pull_request = self
3139 merge_status = PullRequestModel().merge_status(pull_request)
3139 merge_status = PullRequestModel().merge_status(pull_request)
3140
3140 pull_request_url = url(
3141 pull_request_url = url(
3141 'pullrequest_show', repo_name=self.target_repo.repo_name,
3142 'pullrequest_show', repo_name=self.target_repo.repo_name,
3142 pull_request_id=self.pull_request_id, qualified=True)
3143 pull_request_id=self.pull_request_id, qualified=True)
3144
3145 merge_data = {
3146 'clone_url': PullRequestModel().get_shadow_clone_url(pull_request),
3147 'reference': (
3148 pull_request.shadow_merge_ref._asdict()
3149 if pull_request.shadow_merge_ref else None),
3150 }
3151
3143 data = {
3152 data = {
3144 'pull_request_id': pull_request.pull_request_id,
3153 'pull_request_id': pull_request.pull_request_id,
3145 'url': pull_request_url,
3154 'url': pull_request_url,
@@ -3172,10 +3181,7 b' class PullRequest(Base, _PullRequestBase'
3172 'commit_id': pull_request.target_ref_parts.commit_id,
3181 'commit_id': pull_request.target_ref_parts.commit_id,
3173 },
3182 },
3174 },
3183 },
3175 'shadow': {
3184 'merge': merge_data,
3176 'clone_url': PullRequestModel().get_shadow_clone_url(
3177 pull_request),
3178 },
3179 'author': pull_request.author.get_api_data(include_secrets=False,
3185 'author': pull_request.author.get_api_data(include_secrets=False,
3180 details='basic'),
3186 details='basic'),
3181 'reviewers': [
3187 'reviewers': [
General Comments 0
You need to be logged in to leave comments. Login now