Commit 68a7db42 authored by muxator's avatar muxator

cmdcore: override user aliases on hg log

If a user aliased "hg log" to "hg log --graph" (apparently this is widespread,
see [0]), the filter toolbar (CTRL+S), is no longer usable.

The reason is that, under the hood, the filter toolbar parses the textual output
of hg log, which would now be modified by the aliasing [1].

This change undoes any aliasing of hg log, which reverts back to a well-defined
format, ensuring the parsing always succeeds.

The fix comes from a suggestion by Yuya:
https://groups.google.com/forum/#!msg/thg-dev/CTS0X7KYH_8/Qrz1e-gFAgAJ

[0] https://www.mercurial-scm.org/repo/hg/rev/604c086ddde6f40309c03ae7e5050c7c8d87e75a
[1] For example, looking for head() in the filter toolbar caused this error:
        Traceback (most recent call last):
            File "<base>/tortoisehg/hgqt/repomodel.py",
            line 350, in _onQueryFinished
                revs = pycompat.maplist(int, bytes(sess.readAll()).splitlines())
            ValueError: invalid literal for int() with base 10: 'o 19186'

     Where the 'o' comes from the graphlog.
parent d843f9a62e6e
Pipeline #8168 failed with stage
in 19 minutes and 4 seconds
......@@ -256,6 +256,9 @@ def _proccmdline(ui, exts):
for section, name, value in ui.walkconfig()
if ui.configsource(section, name) == b'--config']
configs.extend(('extensions', e, '') for e in exts)
# Override user aliases (for example "alias.log=log --graph") that could
# break searching through the filter toolbar (CTRL+S).
configs.append(('alias', 'log', 'log'))
cmdline = list(paths.get_hg_command())
for section, name, value in configs:
cmdline.extend(('--config', '%s.%s=%s' % (section, name, value)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment