[viewvc-dev] [PATCH] small change we needed in order for -p/hr_funout to work

Daniel Shahaf <[email protected]> Sat, 7 Aug 2010 20:08:14 +0300
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
To enable '-p' diffs (i.e., function names) in the unidiff (diff_format='u')
diff view on svn.apache.org (and also in a standalone.py I ran out of a
pristine viewvc trunk), we had --- besides setting hr_funout=1 in the config
file --- to apply to following patch:

[[[
### This patch is tested.

Index: lib/viewvc.py
===================================================================
--- lib/viewvc.py	(revision 2420)
+++ lib/viewvc.py	(working copy)
@@ -3185,7 +3185,7 @@ def view_diff(request):
     raise debug.ViewVCException('Diff format %s not understood'
                                  % format, '400 Bad Request')
 
-  if human_readable:
+  if human_readable or format == 'u':
     diff_options['funout'] = cfg.options.hr_funout
     diff_options['ignore_white'] = cfg.options.hr_ignore_white
     diff_options['ignore_keyword_subst'] = cfg.options.hr_ignore_keyword_subst
]]]

So, I suppose this or something like it may be desireable for inclusion in
viewvc.  (More precisely, I assume the patch should be edited such that
ignore_white will not apply to format='u'.)

By the way, while writing this mail, I noticed that human_readable is set to
True in the elif branches for 'f', 'l', and 'h', but is elsewhere
initialized as follows:
    'human_readable' : ezt.boolean(diff_format in ('h', 'l')),

So, all in all, I suggest this patch:

[[[
### This patch is NOT tested.

Index: /home/daniel/src/viewvc/trunk/lib/viewvc.py
===================================================================
--- /home/daniel/src/viewvc/trunk/lib/viewvc.py	(revision 2420)
+++ /home/daniel/src/viewvc/trunk/lib/viewvc.py	(working copy)
@@ -2480,7 +2480,7 @@ def view_log(request):
     'rev_selected' : selected_rev,
     'diff_format' : diff_format,
     'logsort' : logsort,
-    'human_readable' : ezt.boolean(diff_format in ('h', 'l')),
+    'human_readable' : ezt.boolean(diff_format in ('f', 'h', 'l')),
     'log_pagestart' : None,
     'log_paging_action' : None,
     'log_paging_hidden_values' : [],
@@ -3185,8 +3185,9 @@ def view_diff(request):
     raise debug.ViewVCException('Diff format %s not understood'
                                  % format, '400 Bad Request')
 
+  if human_readable or format == 'u':
+    diff_options['funout'] = cfg.options.hr_funout
   if human_readable:
-    diff_options['funout'] = cfg.options.hr_funout
     diff_options['ignore_white'] = cfg.options.hr_ignore_white
     diff_options['ignore_keyword_subst'] = cfg.options.hr_ignore_keyword_subst
   try:
]]]

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2644071

To unsubscribe from this discussion, e-mail: [[email protected]].