| Index: appengine/chromium_rietveld/codereview/utils.py
|
| diff --git a/appengine/chromium_rietveld/codereview/utils.py b/appengine/chromium_rietveld/codereview/utils.py
|
| index 1d3ae98b3c67585010c3bc5fb1e0eb4825c97600..3cfd3ecc8752990817699ad31dd8a88b9525ef96 100644
|
| --- a/appengine/chromium_rietveld/codereview/utils.py
|
| +++ b/appengine/chromium_rietveld/codereview/utils.py
|
| @@ -96,9 +96,19 @@ def unify_linebreaks(text):
|
| return text.replace('\r\n', '\n').replace('\r', '\n')
|
|
|
|
|
| -_CQ_STATUS_REGEX = re.compile(
|
| - '(dry run: )?CQ is trying da patch. Follow status at\s+'
|
| - '(https://.+/patch-status/(.+/)?(\d+)/(\d+))\s*', re.I)
|
| +_CQ_STATUS_URL_REGEX = re.compile(
|
| + '^(dry run: )?CQ is trying da patch.\s+Follow status at\s+'
|
| + '(https://.+/patch-status/(.+/)?(\d+)/(\d+))', re.I)
|
| +
|
| +# This is different from above, because status url is not configured for all
|
| +# CQs, in which case CQ posts something like:
|
| +# CQ is trying da patch.
|
| +# Reference: codereview/xxxx/yyy
|
| +_CQ_DRY_RUN_START_REGEX = re.compile(
|
| + '^dry run: CQ is trying da patch.\s+'
|
| + '(Follow status at|Reference:)', re.I)
|
| +
|
| +_CQ_DRY_RUN_MESSAGE = re.compile('^dry run', re.I)
|
|
|
|
|
| def parse_cq_status_url_message(msg):
|
| @@ -109,8 +119,16 @@ def parse_cq_status_url_message(msg):
|
| # Example of message, Dry Run prefix is optional.
|
| # Dry run: CQ is trying da patch. Follow status at
|
| # https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2131593002/1
|
| - match = _CQ_STATUS_REGEX.match(msg)
|
| + match = _CQ_STATUS_URL_REGEX.match(msg)
|
| if not match:
|
| return None, None, None
|
| _, url, _, issue, patchset = match.groups()
|
| return url, int(issue), int(patchset)
|
| +
|
| +
|
| +def is_cq_dry_run_start_message(msg):
|
| + return bool(_CQ_DRY_RUN_START_REGEX.match(msg))
|
| +
|
| +
|
| +def is_cq_dry_message(msg):
|
| + return bool(_CQ_DRY_RUN_MESSAGE.match(msg))
|
|
|