##// END OF EJS Templates
pull-requests: make merge state default as False. This causes a lot of performance problems and should default to faster way
marcink -
r3818:e0a16bba stable
parent child Browse files
Show More
@@ -43,7 +43,8 b' log = logging.getLogger(__name__)'
43
43
44
44
45 @jsonrpc_method()
45 @jsonrpc_method()
46 def get_pull_request(request, apiuser, pullrequestid, repoid=Optional(None)):
46 def get_pull_request(request, apiuser, pullrequestid, repoid=Optional(None),
47 merge_state=Optional(False)):
47 """
48 """
48 Get a pull request based on the given ID.
49 Get a pull request based on the given ID.
49
50
@@ -54,6 +55,9 b' def get_pull_request(request, apiuser, p'
54 :type repoid: str or int
55 :type repoid: str or int
55 :param pullrequestid: ID of the requested pull request.
56 :param pullrequestid: ID of the requested pull request.
56 :type pullrequestid: int
57 :type pullrequestid: int
58 :param merge_state: Optional calculate merge state for each repository.
59 This could result in longer time to fetch the data
60 :type merge_state: bool
57
61
58 Example output:
62 Example output:
59
63
@@ -135,14 +139,15 b' def get_pull_request(request, apiuser, p'
135 # NOTE(marcink): only calculate and return merge state if the pr state is 'created'
139 # NOTE(marcink): only calculate and return merge state if the pr state is 'created'
136 # otherwise we can lock the repo on calculation of merge state while update/merge
140 # otherwise we can lock the repo on calculation of merge state while update/merge
137 # is happening.
141 # is happening.
138 merge_state = pull_request.pull_request_state == pull_request.STATE_CREATED
142 pr_created = pull_request.pull_request_state == pull_request.STATE_CREATED
143 merge_state = Optional.extract(merge_state, binary=True) and pr_created
139 data = pull_request.get_api_data(with_merge_state=merge_state)
144 data = pull_request.get_api_data(with_merge_state=merge_state)
140 return data
145 return data
141
146
142
147
143 @jsonrpc_method()
148 @jsonrpc_method()
144 def get_pull_requests(request, apiuser, repoid, status=Optional('new'),
149 def get_pull_requests(request, apiuser, repoid, status=Optional('new'),
145 merge_state=Optional(True)):
150 merge_state=Optional(False)):
146 """
151 """
147 Get all pull requests from the repository specified in `repoid`.
152 Get all pull requests from the repository specified in `repoid`.
148
153
General Comments 0
You need to be logged in to leave comments. Login now