Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Side by Side Diff: appengine/chromium_rietveld/codereview/utils.py

Issue 2137553002: Rietveld: rely on CQ to decide whether to send email. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2011 Google Inc. 1 # Copyright 2011 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 Args: 90 Args:
91 text: a string. 91 text: a string.
92 92
93 Returns: 93 Returns:
94 A string with all line breaks converted to LF. 94 A string with all line breaks converted to LF.
95 """ 95 """
96 return text.replace('\r\n', '\n').replace('\r', '\n') 96 return text.replace('\r\n', '\n').replace('\r', '\n')
97 97
98 98
99 _CQ_STATUS_REGEX = re.compile( 99 _CQ_STATUS_URL_REGEX = re.compile(
100 '(dry run: )?CQ is trying da patch. Follow status at\s+' 100 '^https://.+/patch-status/(.+/)?(\d+)/(\d+)$', re.I)
101 '(https://.+/patch-status/(.+/)?(\d+)/(\d+))\s*', re.I)
102 101
103 102
104 def parse_cq_status_url_message(msg): 103 def parse_cq_status_url(url):
105 """Returns url, issue, patchset parsed from CQ status message. 104 """Returns issue, patchset parsed from CQ status url.
106 105
107 If parsing failed, returns None, None, None. 106 If parsing failed, returns None, None.
108 """ 107 """
109 # Example of message, Dry Run prefix is optional. 108 # Example of url:
110 # Dry run: CQ is trying da patch. Follow status at
111 # https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.o rg/2131593002/1 109 # https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.o rg/2131593002/1
112 match = _CQ_STATUS_REGEX.match(msg) 110 match = _CQ_STATUS_URL_REGEX.match(url)
113 if not match: 111 if not match:
114 return None, None, None 112 return None, None
115 _, url, _, issue, patchset = match.groups() 113 _, issue, patchset = match.groups()
116 return url, int(issue), int(patchset) 114 return int(issue), int(patchset)
OLDNEW
« no previous file with comments | « appengine/chromium_rietveld/codereview/models.py ('k') | appengine/chromium_rietveld/codereview/views.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698