##// END OF EJS Templates
API: added pull-requests versions into returned API data...
dan -
r4197:01c1fb34 stable
parent child Browse files
Show More
@@ -73,6 +73,7 b' def get_pull_request(request, apiuser, p'
73 "status" : "<status>",
73 "status" : "<status>",
74 "created_on": "<date_time_created>",
74 "created_on": "<date_time_created>",
75 "updated_on": "<date_time_updated>",
75 "updated_on": "<date_time_updated>",
76 "versions": "<number_or_versions_of_pr>",
76 "commit_ids": [
77 "commit_ids": [
77 ...
78 ...
78 "<commit_id>",
79 "<commit_id>",
@@ -4296,6 +4296,7 b' class PullRequest(Base, _PullRequestBase'
4296 def __json__(self):
4296 def __json__(self):
4297 return {
4297 return {
4298 'revisions': self.revisions,
4298 'revisions': self.revisions,
4299 'versions': self.versions_count
4299 }
4300 }
4300
4301
4301 def calculated_review_status(self):
4302 def calculated_review_status(self):
@@ -4318,6 +4319,14 b' class PullRequest(Base, _PullRequestBase'
4318 vcs_obj = self.target_repo.scm_instance()
4319 vcs_obj = self.target_repo.scm_instance()
4319 return vcs_obj.get_shadow_instance(shadow_repository_path)
4320 return vcs_obj.get_shadow_instance(shadow_repository_path)
4320
4321
4322 @property
4323 def versions_count(self):
4324 """
4325 return number of versions this PR have, e.g a PR that once been
4326 updated will have 2 versions
4327 """
4328 return self.versions.count() + 1
4329
4321
4330
4322 class PullRequestVersion(Base, _PullRequestBase):
4331 class PullRequestVersion(Base, _PullRequestBase):
4323 __tablename__ = 'pull_request_versions'
4332 __tablename__ = 'pull_request_versions'
General Comments 0
You need to be logged in to leave comments. Login now