[PATCH] hglib: avoid crash when no options are configured for extdiff cmd (fixes #5551)

3 views
Skip to first unread message

Matt Harbison

unread,
Aug 8, 2022, 5:31:59 PM8/8/22
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1659994294 14400
# Mon Aug 08 17:31:34 2022 -0400
# Branch stable
# Node ID 6d6fb5d21fc573a920071989e090bb12a6485538
# Parent 5636e98ee6b9b10c695f15445b3b174e52a3e88e
hglib: avoid crash when no options are configured for extdiff cmd (fixes #5551)

There's a deprecation warning in `shlex.split()` on py3 about passing `None`,
but the `pycompat` wrapper on py3 never supported it in the first place.

diff --git a/tortoisehg/util/hglib.py b/tortoisehg/util/hglib.py
--- a/tortoisehg/util/hglib.py
+++ b/tortoisehg/util/hglib.py
@@ -604,7 +604,7 @@
if not path:
path = cmd
diffopts = ui.config(b'extdiff', b'opts.' + cmd)
- diffopts = pycompat.shlexsplit(diffopts)
+ diffopts = pycompat.shlexsplit(diffopts) if diffopts else []
diffopts, mergeopts = fixup_extdiff(diffopts)
tools[cmd] = (path, diffopts, mergeopts)
elif cmd.startswith(b'opts.'):

Yuya Nishihara

unread,
Aug 8, 2022, 7:30:26 PM8/8/22
to Matt Harbison, thg...@googlegroups.com
On Mon, 08 Aug 2022 17:31:52 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_h...@yahoo.com>
> # Date 1659994294 14400
> # Mon Aug 08 17:31:34 2022 -0400
> # Branch stable
> # Node ID 6d6fb5d21fc573a920071989e090bb12a6485538
> # Parent 5636e98ee6b9b10c695f15445b3b174e52a3e88e
> hglib: avoid crash when no options are configured for extdiff cmd (fixes #5551)

Queued for stable, thanks.

> --- a/tortoisehg/util/hglib.py
> +++ b/tortoisehg/util/hglib.py
> @@ -604,7 +604,7 @@
> if not path:
> path = cmd
> diffopts = ui.config(b'extdiff', b'opts.' + cmd)
> - diffopts = pycompat.shlexsplit(diffopts)
> + diffopts = pycompat.shlexsplit(diffopts) if diffopts else []

This could be (diffopts or b'') like the other diffargs, but I don't care.
Reply all
Reply to author
Forward
0 new messages