diff mercurial/patch.py @ 15528:a84698badf0b

annotate: support diff whitespace filtering flags (issue3030) splitblock() was added to handle blocks returned by bdiff.blocks() which differ only by blank lines but are not made only of blank lines. I do not know exactly how it could happen but mdiff.blocks() threshold behaviour makes me think it can if those blocks are made of very popular lines mixed with popular blank lines. If it is proven to be wrong, the function can be dropped. The first implementation made annotate share diff configuration entries. But it looks like users will user -w/b for annotate but not for diff, on both the command line and hgweb. Since the latter cannot use command line entries, we introduce a new [annotate] section duplicating the diff whitespace options.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 18 Nov 2011 12:04:31 +0100
parents 5414b56cfad6
children 97fc5eec3f43
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Nov 20 19:14:36 2011 +0100
+++ b/mercurial/patch.py	Fri Nov 18 12:04:31 2011 +0100
@@ -1527,10 +1527,10 @@
 class GitDiffRequired(Exception):
     pass
 
-def diffopts(ui, opts=None, untrusted=False):
+def diffopts(ui, opts=None, untrusted=False, section='diff'):
     def get(key, name=None, getter=ui.configbool):
         return ((opts and opts.get(key)) or
-                getter('diff', name or key, None, untrusted=untrusted))
+                getter(section, name or key, None, untrusted=untrusted))
     return mdiff.diffopts(
         text=opts and opts.get('text'),
         git=get('git'),