| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import re | 5 import re |
| 6 | 6 |
| 7 CODE_REVIEW_URL_PATTERN = re.compile( | 7 CODE_REVIEW_URL_PATTERN = re.compile( |
| 8 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) | 8 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) |
| 9 COMMIT_POSITION_PATTERN = re.compile( | 9 COMMIT_POSITION_PATTERN = re.compile( |
| 10 '^Cr-Commit-Position: refs/heads/master@{#(\d+)}$', re.IGNORECASE) | 10 '^Cr-Commit-Position: refs/heads/master@{#(\d+)}$', re.IGNORECASE) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 """Parse message to get the reverted revision if there is one.""" | 62 """Parse message to get the reverted revision if there is one.""" |
| 63 lines = message.strip().splitlines() | 63 lines = message.strip().splitlines() |
| 64 if not lines[0].lower().startswith('revert'): | 64 if not lines[0].lower().startswith('revert'): |
| 65 return None | 65 return None |
| 66 | 66 |
| 67 for line in reversed(lines): # pragma: no cover | 67 for line in reversed(lines): # pragma: no cover |
| 68 # TODO: Handle cases where no reverted_revision in reverting message. | 68 # TODO: Handle cases where no reverted_revision in reverting message. |
| 69 reverted_revision_match = REVERTED_REVISION_PATTERN.match(line) | 69 reverted_revision_match = REVERTED_REVISION_PATTERN.match(line) |
| 70 if reverted_revision_match: | 70 if reverted_revision_match: |
| 71 return reverted_revision_match.group(1) | 71 return reverted_revision_match.group(1) |
| OLD | NEW |