Author: gstein Date: Sun Oct 22 05:19:13 2023 New Revision: 1913187 URL: http://svn.apache.org/viewvc?rev=1913187&view=rev Log: Switch to gathering a group of all four types of modifications into a summary of paths changed.
* tools/hook-scripts/mailer/mailer.py: (generate_content): use generate_summary() rather than a group of generate_list() calls. Pull individual bits out, for now. (generate_list): removed. supplanted by: (generate_summary): return a data object with four attributes with lists of added, replaced, deleted, and modified paths. Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1913187&r1=1913186&r2=1913187&view=diff ============================================================================== --- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original) +++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Sun Oct 22 05:19:13 2023 @@ -792,10 +792,11 @@ def generate_content(writer, cfg, repos, other_added_data = other_replaced_data = other_deleted_data = \ other_modified_data = [ ] if len(paths) != len(changelist) and show_nonmatching_paths != 'no': - other_added_data = generate_list('A', changelist, paths, False) - other_replaced_data = generate_list('R', changelist, paths, False) - other_deleted_data = generate_list('D', changelist, paths, False) - other_modified_data = generate_list('M', changelist, paths, False) + other_summary = generate_summary(changelist, paths, False) + other_added_data = other_summary.added + other_replaced_data = other_summary.replaced + other_deleted_data = other_summary.deleted + other_modified_data = other_summary.modified if len(paths) != len(changelist) and show_nonmatching_paths == 'yes': other_diffs = DiffGenerator(changelist, paths, False, cfg, repos, date, @@ -803,16 +804,18 @@ def generate_content(writer, cfg, repos, else: other_diffs = None + summary = generate_summary(changelist, paths, True) + data = _data( author=repos.author, date=date, rev=repos.rev, log=to_str(repos.get_rev_prop(svn.core.SVN_PROP_REVISION_LOG) or b''), commit_url=commit_url, - added_data=generate_list('A', changelist, paths, True), - replaced_data=generate_list('R', changelist, paths, True), - deleted_data=generate_list('D', changelist, paths, True), - modified_data=generate_list('M', changelist, paths, True), + added_data=summary.added, + replaced_data=summary.replaced, + deleted_data=summary.deleted, + modified_data=summary.modified, show_nonmatching_paths=show_nonmatching_paths, other_added_data=other_added_data, other_replaced_data=other_replaced_data, @@ -828,14 +831,15 @@ def generate_content(writer, cfg, repos, render_commit(w, wb, data) -def generate_list(changekind, changelist, paths, in_paths): - action = { - 'A': svn.repos.CHANGE_ACTION_ADD, - 'R': svn.repos.CHANGE_ACTION_REPLACE, - 'D': svn.repos.CHANGE_ACTION_DELETE, - 'M': svn.repos.CHANGE_ACTION_MODIFY, - }.get(changekind) - return _gather_paths(action, changelist, paths, in_paths) +def generate_summary(changelist, paths, in_paths): + def gather_info(action): + return _gather_paths(action, changelist, paths, in_paths) + return _data( + added=gather_info(svn.repos.CHANGE_ACTION_ADD), + replaced=gather_info(svn.repos.CHANGE_ACTION_REPLACE), + deleted=gather_info(svn.repos.CHANGE_ACTION_DELETE), + modified=gather_info(svn.repos.CHANGE_ACTION_MODIFY), + ) def _gather_paths(action, changelist, paths, in_paths):