Index: mailer.py =================================================================== --- mailer.py (revision 35245) +++ mailer.py (working copy) @@ -722,7 +722,7 @@ params, diffsels, diffurls, pool), other_diffs=other_diffs, ) - renderer.render(data) + renderer.render(data,cfg,group,params) def generate_list(changekind, changelist, paths, in_paths): @@ -1005,7 +1005,7 @@ def __init__(self, output): self.output = output - def render(self, data): + def render(self, data,cfg,group,params): "Render the commit defined by 'data'." w = self.output.write @@ -1038,11 +1038,11 @@ else: w('and changes in other areas\n') - self._render_diffs(data.diffs, '') + self._render_diffs(data.diffs, '',cfg,group,params) if data.other_diffs: self._render_diffs(data.other_diffs, '\nDiffs of changes in other areas also' - ' in this revision:\n') + ' in this revision:\n',cfg,group,params) def _render_list(self, header, data_list): if not data_list: @@ -1073,15 +1073,27 @@ w(' - copied%s from r%d, %s%s\n' % (text, d.base_rev, d.base_path, is_dir)) - def _render_diffs(self, diffs, section_header): + def _render_diffs(self, diffs, section_header,cfg,group,params): """Render diffs. Write the SECTION_HEADER if there are actually any diffs to render.""" if not diffs: return w = self.output.write section_header_printed = False + jnumber = cfg.get('max_number_of_diffs',group,params) + try: + max_number = int(jnumber) + except ValueError: + max_number = -1 + i=0 for diff in diffs: + i=i+1 + if i > max_number and -1 != max_number: + w('\n\n================ MAX NUMBER OF FILES=%s' % max_number) + w(' IS REACHED, NO MORE DIFF ================\n\n') + break + if not diff.diff and not diff.diff_url: continue if not section_header_printed: Index: mailer.conf.example =================================================================== --- mailer.conf.example (revision 35245) +++ mailer.conf.example (working copy) @@ -243,6 +243,10 @@ # Set to 0 to turn off. #truncate_subject = 200 +# Maximal number of diffed files. To prevent really big emails. +# 0 means no diffs included, below 0 means no limit +# max_number_of_diffs = 128 + # -------------------------------------------------------------------------- [maps]