Skip to content

Commit a3bba0d

Browse files
committedJan 2, 2019
Process the "ignore-this-changeset" commit message flag (bug 1514822)
1 parent 7cd8265 commit a3bba0d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎committelemetry/classifier.py

+15
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ def has_wpt_uplift_markers(commit_author: str, summary: str) -> bool:
205205
)
206206

207207

208+
def has_ignore_this_changeset_marker(summary: str) -> bool:
209+
"""Does this changeset summary say the changeset should be entirely ignored?
210+
211+
Case in point for this marker is a BIG automated change to the entire source tree.
212+
See https://hg.mozilla.org/mozilla-central/json-rev/6f3709b3878117466168c40affa7bca0b60cf75b
213+
for an example.
214+
"""
215+
return "# ignore-this-changeset" in summary
216+
217+
208218
def split_summary(s: str) -> str:
209219
"""Split a commit message summary from the long-form description.
210220
@@ -236,6 +246,11 @@ def determine_review_system(revision_json):
236246
if has_backout_markers(summary):
237247
log.info(f'changeset {changeset}: changeset is a back-out commit')
238248
return ReviewSystem.review_unneeded
249+
elif has_ignore_this_changeset_marker(summary):
250+
log.info(
251+
f'changeset {changeset}: changeset summary has "ignore-this-changeset" flag'
252+
)
253+
return ReviewSystem.not_applicable
239254
elif has_merge_markers(revision_json):
240255
log.info(f'changeset {changeset}: is a merge commit')
241256
return ReviewSystem.not_applicable

‎tests/test_classifier.py

+10
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ def test_has_uplift_markers(test_input, expected):
193193
assert has_uplift_markers(test_input) == expected
194194

195195

196+
def test_has_ignore_this_change_marker():
197+
from committelemetry.classifier import has_ignore_this_changeset_marker
198+
199+
summary = """\
200+
Reformat the entire source tree
201+
# ignore-this-changeset
202+
"""
203+
assert has_ignore_this_changeset_marker(summary)
204+
205+
196206
def test_obsolete_attachments_are_filtered_out():
197207
from committelemetry.classifier import collect_review_attachments
198208

0 commit comments

Comments
 (0)
Failed to load comments.