[webkit-changes] [WebKit/WebKit] 09a80b: [webkitscmpy] Make parsing of trailers stricter
Sam Sneddon
noreply at github.com
Tue Feb 4 15:01:18 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 09a80b732c63a08a1398784f85b057577589aefc
https://github.com/WebKit/WebKit/commit/09a80b732c63a08a1398784f85b057577589aefc
Author: Sam Sneddon <gsnedders at apple.com>
Date: 2025-02-04 (Tue, 04 Feb 2025)
Changed paths:
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/commit.py
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/canonicalize/__init__.py
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/canonicalize/message.py
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/canonicalize_unittest.py
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/commit_unittest.py
M Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/trace_unittest.py
Log Message:
-----------
[webkitscmpy] Make parsing of trailers stricter
https://bugs.webkit.org/show_bug.cgi?id=282792
Reviewed by Brianna Fan and Jonathan Bedard.
This requires trailer keys to match either the grammar allowed by git
or to be literally the string (case sensitively) "Canonical link".
This prevents webkitscmpy.program.trace.Relationship from finding
trailers whose key is "Originally landed as", but we've never actually
landed such a commit (we always use Originally-landed-as).
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/commit.py:
(Commit): Change constants TRAILER_RE per above, add GIT_SPACE to
match what git treats as space.
(Commit.trailers): Split literally just on \n, and trim whitespace on
the value. Also avoid prepending repeatedly (O(n*2)), instead just
reverse at the end (O(n)).
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/canonicalize/__init__.py:
(Canonicalize.parser): Drive-by: fix double-space.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/canonicalize/message.py:
(rewrite_message): Drive-by: factor out identifier_template_key.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/canonicalize_unittest.py:
(TestCanonicalizeProgam): Renamed from TestCanonicalize.
(TestCanonicalizeProgam.setUp): Ditto.
(TestCanonicalizeProgam.test_number): Drive-by: remove unused variable.
(TestCanonicalizeMessage): Add a lot of new tests.
(TestCanonicalizeMessage.assert_canonicalized_commit_message):
(TestCanonicalizeMessage.test_incomplete_line):
(TestCanonicalizeMessage.test_multiple_existing_identifier_trailers):
(TestCanonicalizeMessage.test_multiple_existing_identifier_single_trailer):
(TestCanonicalizeMessage.test_existing_non_trailer_identifier_regression):
(TestCanonicalizeMessage.test_existing_non_trailer_identifier):
(TestCanonicalizeMessage.test_existing_non_trailer_identifier_long):
(TestCanonicalizeMessage.test_existing_identifier_and_non_trailer_identifier):
(TestCanonicalizeMessage.test_not_alternate_trailer):
(TestCanonicalizeMessage.test_partial_trailer_group_unknown_trailer_regression):
(TestCanonicalizeMessage.test_partial_trailer_group_unknown_trailer):
(TestCanonicalizeMessage.test_partial_trailer_group_known_trailer):
(TestCanonicalizeMessage.test_partial_trailer_group_known_identifier_trailer):
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/commit_unittest.py:
Even more new tests.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/trace_unittest.py:
(TestRelationship.test_cherry_pick): Test parsing of 'Originally landed as'.
Canonical link: https://commits.webkit.org/289828@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list