Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit 53ec5eb

Browse files
committedMay 25, 2018
Exclude changes requested by WPR Sync Bot
Exclude changesets that were requested by the Web Platform Test Sync Bot account. These changes were reviewed in the upstream project.
1 parent 41e0002 commit 53ec5eb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
 

‎committelemetry/classifier.py

+19
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
# Match 'no bug' anywhere in the commit message summary
3434
NOBUG_RE = re.compile(r'\bno bug\b', re.IGNORECASE)
3535

36+
# Match '[wpt PR 1234] - summary a=testonly'
37+
WPT_SYNC_BOT_RE = re.compile(r'\[wpt PR \d+\](.*) a=testonly')
38+
3639

3740
class ReviewSystem(Enum):
3841
"""The review system used for a commit.
@@ -160,6 +163,15 @@ def has_no_bug_marker(summary: str) -> bool:
160163
return bool(re.search(NOBUG_RE, summary))
161164

162165

166+
def has_wpt_uplift_markers(summary: str) -> bool:
167+
"""Was this commit by the Web Platform Test Sync Bot?
168+
169+
See https://hg.mozilla.org/mozilla-central/rev/e2dced9fda47999677b840a58f5e39b2217881e8
170+
for an example commit.
171+
"""
172+
return bool(re.search(WPT_SYNC_BOT_RE, summary))
173+
174+
163175
def split_summary(s: str) -> str:
164176
"""Split a commit message summary from the long-form description.
165177
@@ -195,6 +207,13 @@ def determine_review_system(revision_json):
195207
elif has_no_bug_marker(summary):
196208
log.info(f'changeset {changeset}: summary is marked "no bug"')
197209
return ReviewSystem.no_bug
210+
elif has_wpt_uplift_markers(summary):
211+
# This commit was requested by a bot account that vendors an external
212+
# project into the tree. We can ignore it.
213+
log.info(
214+
f'changeset {changeset}: changeset was requested by moz-wptsync-bot'
215+
)
216+
return ReviewSystem.not_applicable
198217

199218
# 1. Check for Phabricator because it's easiest.
200219
# TODO can we rely on BMO attachments for this?

‎tests/test_classifier.py

+11
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,14 @@ def test_summary_splitting(test_input, expected):
4949
assert split_summary(test_input) == expected
5050

5151

52+
@pytest.mark.parametrize(
53+
"test_input,expected", [
54+
("Bug 123 - [wpt PR 123] foo bar a=testonly", True),
55+
("Bug 123 - [wpt PR 123] foo bar a=testonly extra", True),
56+
("Bug 123 - [wpt PR 123]", False),
57+
("Bug 123 - foo bar a=testonly", False),
58+
]
59+
) # yapf: disable
60+
def test_has_wpt_uplift_markers(test_input, expected):
61+
from committelemetry.classifier import has_wpt_uplift_markers
62+
assert has_wpt_uplift_markers(test_input) == expected

0 commit comments

Comments
 (0)
Failed to load comments.