Max Bowsher wrote:
> cmpilato@tigris.org wrote:
> > Author: cmpilato
> > Date: Fri Jun 24 12:02:53 2005
> > New Revision: 15160
> >
> > Modified:
> > trunk/tools/hook-scripts/mailer/mailer.py
> >
> > Log:
> > A few fixes to mailer.py. Patch by
Servatius.Brandt@fujitsu-siemens.com.
[...]
> > (generate_content): Add 'show_nonmatching_paths' to the data
> > dictionary.
>
> Superficial fix, not truly fixing the bugs in this area.
> If show_nonmatching_paths == 'no', then no sign that nonmatching paths
> existed at all gets put in data, so "and changes in other areas" can
never
> appear.
> And TextCommitRenderer.render tests data.show_matching_paths as a
boolean,
> but it's not a boolean, it's a tristate string.
The patch below fixes these problems.
I got also another problem when showing diffs for nonmatching paths:
Diffs of changes in other areas also in this revision:
sys.argv[3:3+expected_args])
File "/usr/lib/python2.4/site-packages/svn/core.py", line 40, in
run_app
return apply(func, (pool,) + args, kw)
File "./mailer.py", line 74, in main
messenger.generate()
File "./mailer.py", line 358, in generate
group, params, paths, subpool)
File "./mailer.py", line 607, in generate_content
renderer.render(data)
File "./mailer.py", line 843, in render
self._render_diffs(data.other_diffs)
File "./mailer.py", line 878, in _render_diffs
if diff.kind == 'D':
AttributeError: DiffGenerator instance has no attribute 'kind'
The reason is that
other_diffs = DiffGenerator(....)
assigns a tuple to other_diffs which causes the failure, whereas
data = _data(....
diffs=DiffGenerator(....),
other_diffs=other_diffs,
....
)
doesn't. So showing the matching diffs worked fine, but showing
other_diffs failed. Pdb output:
(Pdb) other_diffs
(<__main__.DiffGenerator instance at 0x59d62c>,)
(Pdb) data.other_diffs
(<__main__.DiffGenerator instance at 0x59d62c>,)
(Pdb) data.diffs
<__main__.DiffGenerator instance at 0x59dd4c>
I don't actually know why the assignment to other_diffs causes the
tupling, but changing it to
(other_diffs,) = DiffGenerator(....)
solves the problem. This is also contained in the patch.
- Servatius
Index: mailer.py
===================================================================
--- mailer.py (revision 22)
+++ mailer.py (working copy)
@@ -572,16 +572,17 @@
show_nonmatching_paths = cfg.get('show_nonmatching_paths', group,
params) \
or 'yes'
+ nonmatching_paths = len(paths) != len(changelist)
# figure out the lists of changes outside the selected path-space
other_added_data = other_removed_data = other_modified_data = [ ]
- if len(paths) != len(changelist) and show_nonmatching_paths != 'no':
+ if nonmatching_paths and show_nonmatching_paths != 'no':
other_added_data = generate_list('A', changelist, paths, False)
other_removed_data = generate_list('R', changelist, paths, False)
other_modified_data = generate_list('M', changelist, paths, False)
- if len(paths) != len(changelist) and show_nonmatching_paths == 'yes':
- other_diffs = DiffGenerator(changelist, paths, False, cfg, repos,
date,
+ if nonmatching_paths and show_nonmatching_paths == 'yes':
+ (other_diffs,) = DiffGenerator(changelist, paths, False, cfg,
repos, date,
group, params, diffsels, pool),
else:
other_diffs = [ ]
@@ -594,6 +595,7 @@
added_data=generate_list('A', changelist, paths, True),
removed_data=generate_list('R', changelist, paths, True),
modified_data=generate_list('M', changelist, paths, True),
+ nonmatching_paths=nonmatching_paths,
show_nonmatching_paths=show_nonmatching_paths,
other_added_data=other_added_data,
other_removed_data=other_removed_data,
@@ -824,9 +826,8 @@
self._render_list('Removed', data.removed_data)
self._render_list('Modified', data.modified_data)
- if data.other_added_data or data.other_removed_data \
- or data.other_modified_data:
- if data.show_nonmatching_paths:
+ if data.nonmatching_paths:
+ if data.show_nonmatching_paths != 'no':
w('\nChanges in other areas also in this revision:\n')
self._render_list('Added', data.other_added_data)
self._render_list('Removed', data.other_removed_data)
------------------------------------------------------------------------
Servatius Brandt Phone: +49 89 636-41504
Fujitsu Siemens Computers Fax: +49 89 636-48716
EP SW AD C++ Email: Servatius.Brandt@fujitsu-siemens.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jun 28 17:11:04 2005