[issue2559] Cannot escape branch name in template

John Peberdy bugs at mercurial.selenic.com
Sat Dec 18 15:08:30 CST 2010


New submission from John Peberdy <john at peberdy.ca>:

Branch names can contain < and > characters but it's not possible to escape
them using a template for example: <br v="{branches|escape}"/>

See also: http://www.javaforge.com/issue/13402

$ hg -y log --style
/home/john/runtime-New_configuration/.metadata/.plugins/com.vectrace.MercurialEclipse/log_style
--limit 500 
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.5 (release26-maint, Oct 24 2010, 22:05:19) [GCC 4.3.4]
** Mercurial Distributed SCM (version 1.7)
** Extensions loaded: rebase, eol, graphlog, transplant, mq
Traceback (most recent call last):
  File "/usr/bin/hg-2.6", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 16,
in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 36,
in dispatch
    return _runcatch(u, args)
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 58,
in _runcatch
    return _dispatch(ui, args)
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 590,
in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 401,
in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 641,
in _runcommand
    return checkargs()
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 595,
in checkargs
    return cmdfunc()
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 588,
in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 427, in
check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/extensions.py", line
130, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 427, in
check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/hgext/mq.py", line 2979, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 427, in
check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/extensions.py", line
130, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 427, in
check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/hgext/graphlog.py", line 323, in
graph
    return orig(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 427, in
check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mercurial/commands.py", line
2548, in log
    for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
  File "/usr/lib64/python2.6/site-packages/mercurial/cmdutil.py", line 1278,
in iterate
    prepare(ctx, fns)
  File "/usr/lib64/python2.6/site-packages/mercurial/commands.py", line
2546, in prep
    displayer.show(ctx, copies=copies, matchfn=revmatchfn)
  File "/usr/lib64/python2.6/site-packages/mercurial/cmdutil.py", line 770,
in show
    self._show(ctx, copies, matchfn, props)
  File "/usr/lib64/python2.6/site-packages/mercurial/cmdutil.py", line 979,
in _show
    self.ui.write(templater.stringify(self.t(key, **props)))
  File "/usr/lib64/python2.6/site-packages/mercurial/templatefilters.py",
line 14, in stringify
    return "".join([stringify(t) for t in thing if t is not None])
  File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 244, in
increasingchunks
    for chunk in source:
  File "/usr/lib64/python2.6/site-packages/mercurial/templater.py", line 23,
in _flatten
    for i in thing:
  File "/usr/lib64/python2.6/site-packages/mercurial/templater.py", line
164, in _process
    yield f(mapping, e)
  File "/usr/lib64/python2.6/site-packages/mercurial/templater.py", line 93,
in _filter
    x = f(x)
  File "/usr/lib64/python2.6/site-packages/mercurial/templatefilters.py",
line 202, in <lambda>
    "escape": lambda x: cgi.escape(x, True),
  File "/usr/lib64/python2.6/cgi.py", line 1035, in escape
    s = s.replace("&", "&amp;") # Must be done first!
AttributeError: 'NoneType' object has no attribute 'replace'

----------
messages: 14711
nosy: johnpeb
priority: bug
status: unread
title: Cannot escape branch name in template

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2559>
____________________________________________________


More information about the Mercurial-devel mailing list