##// 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 73 "status" : "<status>",
74 74 "created_on": "<date_time_created>",
75 75 "updated_on": "<date_time_updated>",
76 "versions": "<number_or_versions_of_pr>",
76 77 "commit_ids": [
77 78 ...
78 79 "<commit_id>",
@@ -4296,6 +4296,7 b' class PullRequest(Base, _PullRequestBase'
4296 4296 def __json__(self):
4297 4297 return {
4298 4298 'revisions': self.revisions,
4299 'versions': self.versions_count
4299 4300 }
4300 4301
4301 4302 def calculated_review_status(self):
@@ -4318,6 +4319,14 b' class PullRequest(Base, _PullRequestBase'
4318 4319 vcs_obj = self.target_repo.scm_instance()
4319 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 4331 class PullRequestVersion(Base, _PullRequestBase):
4323 4332 __tablename__ = 'pull_request_versions'
General Comments 0
You need to be logged in to leave comments. Login now