Bug 4399 - ifcontains stack traces on strings
Summary: ifcontains stack traces on strings
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: templater (show other bugs)
Version: unspecified
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-06 20:14 UTC by Jordi Gutiérrez Hermoso
Modified: 2015-01-22 15:04 UTC (History)
1 user (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordi Gutiérrez Hermoso 2014-10-06 20:14 UTC
The following stack traces:

   $ hg log -r . -T '{ifcontains(phase, "secret public", "lol", "omg")}\n'

    ** Unknown exception encountered with possibly-broken third-party extension crecord
    ** which supports versions unknown of Mercurial.
    ** Please disable crecord and try your action again.
    ** If that fixes the bug please report it to the extension author.
    ** Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2]
    ** Mercurial Distributed SCM (version 3.1.2+107-8b09e0c3c0f8)
    ** Extensions loaded: convert, strip, record, churn, purge, rebase, highlight, color, progress, patchbomb, histedit, largefiles, shelve, pager, hggit, crecord, evolve
    Traceback (most recent call last):
      File "/home/jordi/coding/vcs/mercurial-source/hg", line 43, in <module>
        mercurial.dispatch.run()
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 28, in run
        sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 71, in dispatch
        ret = _runcatch(req)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 140, in _runcatch
        return _dispatch(req)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 850, in _dispatch
        cmdpats, cmdoptions)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 611, in runcommand
        ret = _runcommand(ui, options, cmd, d)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/extensions.py", line 196, in wrap
        return wrapper(origfn, *args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/hgext/pager.py", line 158, in pagecmd
        return orig(ui, options, cmd, cmdfunc)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/extensions.py", line 196, in wrap
        return wrapper(origfn, *args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/hgext/color.py", line 472, in colorcmd
        return orig(ui_, opts, cmd, cmdfunc)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 941, in _runcommand
        return checkargs()
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 912, in checkargs
        return cmdfunc()
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/dispatch.py", line 847, in <lambda>
        d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/util.py", line 567, in check
        return func(*args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/extensions.py", line 151, in wrap
        util.checksignature(origfn), *args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/util.py", line 567, in check
        return func(*args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/hgext/largefiles/overrides.py", line 320, in overridelog
        return orig(ui, repo, *pats, **opts)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/util.py", line 567, in check
        return func(*args, **kwargs)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/commands.py", line 4466, in log
        displayer.show(ctx, copies=copies, matchfn=revmatchfn)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/cmdutil.py", line 878, in show
        self._show(ctx, copies, matchfn, props)
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/cmdutil.py", line 1198, in _show
        self.ui.write(templater.stringify(self.t(key, **props)))
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/templatefilters.py", line 322, in stringify
        return "".join([stringify(t) for t in thing if t is not None])
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/util.py", line 409, in increasingchunks
        for chunk in source:
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/templater.py", line 573, in _flatten
        for j in _flatten(i):
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/templater.py", line 566, in _flatten
        for i in thing:
      File "/home/jordi/coding/vcs/mercurial-source/mercurial/templater.py", line 333, in ifcontains
        if item in [i.values()[0] for i in items()]:
    TypeError: 'str' object is not callable

I have made no attempt to diagnose this.
Comment 1 HG Bot 2014-10-10 13:30 UTC
Fixed by http://selenic.com/repo/hg/rev/b6531d806de8
Matt Mackall <mpm@selenic.com>
templater: fix ifcontains when list is a string (issue4399)

(please test the fix)
Comment 2 Matt Mackall 2015-01-22 15:04 UTC
Bulk testing -> fixed