unexpanded tabs / mercurial web / diff

unexpanded tabs / mercurial web / diff

  • Written by
    Walter Doekes
  • Published on

The hgweb mercurial web interface on current Debian/Squeeze (mercurial-common 1.5.1-2) lists tab characters as-is in the diff view.

Every line is prefixed not only by a plus or a minus (unified diff), but also by file and line numbers. This can cause a tab (0x9) character to appear as a single space. This does not look nice.

The following patch can be applied to expand the tab character so the intentation looks right again.

--- /usr/share/pyshared/mercurial/hgweb/webutil.py.orig 2010-05-07 09:41:17.000000000 +0200
+++ /usr/share/pyshared/mercurial/hgweb/webutil.py      2010-05-07 09:47:53.000000000 +0200
@@ -177,6 +177,7 @@ def diffs(repo, tmpl, ctx, files, parity
                 ltype = "difflineat"
             else:
                 ltype = "diffline"
+            l = l.expandtabs()
             yield tmpl(ltype,
                        line=l,
                        lineid="l%s" % lineno,

Back to overview Newer post: uninitialized globals / C language Older post: mysql utf8 collation / conversion