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.
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1913187 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/hook-scripts/mailer/mailer.py b/tools/hook-scripts/mailer/mailer.py
index 0826cac..589c9c6 100755
--- a/tools/hook-scripts/mailer/mailer.py
+++ b/tools/hook-scripts/mailer/mailer.py
@@ -792,10 +792,11 @@
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 @@
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 @@
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):