diff mercurial/hgweb/webcommands.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 d06b9c55ddab
children 917f263eeb26
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Nov 20 19:14:36 2011 +0100
+++ b/mercurial/hgweb/webcommands.py	Fri Nov 18 12:04:31 2011 +0100
@@ -12,7 +12,7 @@
 from mercurial.util import binary
 from common import paritygen, staticfile, get_contact, ErrorResponse
 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
-from mercurial import graphmod
+from mercurial import graphmod, patch
 from mercurial import help as helpmod
 from mercurial.i18n import _
 
@@ -576,6 +576,7 @@
     fctx = webutil.filectx(web.repo, req)
     f = fctx.path()
     parity = paritygen(web.stripecount)
+    diffopts = patch.diffopts(web.repo.ui, untrusted=True, section='annotate')
 
     def annotate(**map):
         last = None
@@ -585,7 +586,8 @@
             lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
                                 '(binary:%s)' % mt)])
         else:
-            lines = enumerate(fctx.annotate(follow=True, linenumber=True))
+            lines = enumerate(fctx.annotate(follow=True, linenumber=True,
+                                            diffopts=diffopts))
         for lineno, ((f, targetline), l) in lines:
             fnode = f.filenode()