mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
This CL adds a "early terminate the field based on field value" parser mechanism to end the field as soon as the field value provides an unambiguous answer to the question we care about. This is to prevent over-extraction over certain fields (specifically, local modifications) which can either be a definitive answer (e.g. No modification) or multi-line free-form texts (which may contain unknown fields that we don't care about at this stage). This mitigates over extraction of README.chromium files like: ``` Local Modifications: None How to Uprev: Steps... ``` Where the old parser would extract "None\n\nHow to Uprev:\nSteps..." This CL also refactors single line fields to use the same early termination mechanism since single line field simply ends as soon as the line is parsed. Union[Something, None] is changed to Optional[Something] based on styleguide. Bug: b/324149233 Change-Id: I3fca80eaceb071263f8ae8730afda230fff0bbb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5394917 Reviewed-by: Anne Redulla <aredulla@google.com> Commit-Queue: Jiewei Qian <qjw@chromium.org>
30 lines
547 B
Plaintext
30 lines
547 B
Plaintext
Name: Test package 1
|
|
Local Modifications:
|
|
|
|
1. Modified X file
|
|
2. Deleted Y file
|
|
|
|
-------------------- DEPENDENCY DIVIDER --------------------
|
|
|
|
Name: Test package 2
|
|
Local Modifications: None
|
|
|
|
-------------------- DEPENDENCY DIVIDER --------------------
|
|
|
|
Name: Test package 3
|
|
|
|
Local Modifications:
|
|
|
|
None.
|
|
|
|
Uprev Instructions:
|
|
This section should not be extracted into Local Modifications.
|
|
1. Do X
|
|
2. Do Y
|
|
3. Commit
|
|
|
|
-------------------- DEPENDENCY DIVIDER --------------------
|
|
|
|
Name: Test package 4
|
|
Local Modifications: None,
|
|
Except modified file X. |