| OLD | NEW |
| 1 # Copyright 2008 Google Inc. | 1 # Copyright 2008 Google Inc. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return message.date | 497 return message.date |
| 498 return None | 498 return None |
| 499 | 499 |
| 500 def get_time_since_landed(self): | 500 def get_time_since_landed(self): |
| 501 """Returns approximate time since issue was landed or None.""" | 501 """Returns approximate time since issue was landed or None.""" |
| 502 landed = self.get_landed_date() | 502 landed = self.get_landed_date() |
| 503 if landed: | 503 if landed: |
| 504 return datetime.datetime.now() - landed | 504 return datetime.datetime.now() - landed |
| 505 return None | 505 return None |
| 506 | 506 |
| 507 def update_cq_status_url_if_any(self, cq_message): | 507 def update_cq_status_url_if_any(self, url): |
| 508 """Parses the cq_message for CQ status url and updates corresponding | 508 """Parses the cq_message for CQ status url and updates corresponding |
| 509 patchset with it. | 509 patchset with it. |
| 510 """ | 510 """ |
| 511 url, issue_num, patchset_num = utils.parse_cq_status_url_message(cq_message) | |
| 512 if not url: | 511 if not url: |
| 513 return | 512 return |
| 513 issue_num, patchset_num = utils.parse_cq_status_url(url) |
| 514 if self.key.id() != issue_num: | 514 if self.key.id() != issue_num: |
| 515 logging.error('CQ posted CQ Status URL %s to the wrong issue %s', | 515 logging.error('CQ posted CQ Status URL %s to the wrong issue %s', |
| 516 url, self.key.id()) | 516 url, self.key.id()) |
| 517 return | 517 return |
| 518 for patchset in self.patchsets: | 518 for patchset in self.patchsets: |
| 519 if patchset.key.id() == patchset_num: | 519 if patchset.key.id() == patchset_num: |
| 520 patchset.cq_status_url = url | 520 patchset.cq_status_url = url |
| 521 patchset.put() | 521 patchset.put() |
| 522 logging.info('saved cq_status_url %s to patchset %s', url, patchset.key) | 522 logging.info('saved cq_status_url %s to patchset %s', url, patchset.key) |
| 523 return | 523 return |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 out.issues = sum((i.issues for i in items), []) | 1929 out.issues = sum((i.issues for i in items), []) |
| 1930 out.latencies = sum((i.latencies for i in items), []) | 1930 out.latencies = sum((i.latencies for i in items), []) |
| 1931 out.lgtms = sum((i.lgtms for i in items), []) | 1931 out.lgtms = sum((i.lgtms for i in items), []) |
| 1932 out.review_types = sum((i.review_types for i in items), []) | 1932 out.review_types = sum((i.review_types for i in items), []) |
| 1933 out.score = compute_score(out) | 1933 out.score = compute_score(out) |
| 1934 return ( | 1934 return ( |
| 1935 prev_issues != out.issues or | 1935 prev_issues != out.issues or |
| 1936 prev_latencies != out.latencies or | 1936 prev_latencies != out.latencies or |
| 1937 prev_lgtms != out.lgtms or | 1937 prev_lgtms != out.lgtms or |
| 1938 prev_review_types != out.review_types) | 1938 prev_review_types != out.review_types) |
| OLD | NEW |