Port the regex counting feature from the mako_changes-20230429 branch (2ff4d60): the -RPc/--revision-pattern-count and -CPc/--comment-pattern-count flags cause revision and comment patterns to output the number of matches instead of the matched text, with 0 (never null) for revisions with no matches or deleted content. The flags apply to all revision or comment patterns respectively, and count columns are typed int64 in the output schema. Counting the matches of common or large patterns previously required returning the full matched text, which made for very large outputs. Also take the code review suggestion from that branch (933ca75): use assignment expressions so matching no longer makes redundant calls to search() before finditer()/findall() or calls match.group() twice. Includes unit tests for the count semantics and schema types, and an end-to-end test that verifies counts against the number of matches recomputed from each revision's text and comment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit0b6e0fbc70)
34 KiB
34 KiB