diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -121,7 +121,7 @@ def dodiff(ui, repo, diffcmd, diffopts, revs = opts.get('rev') change = opts.get('change') - args = ' '.join(diffopts) + args = ' '.join(map(util.shellquote, diffopts)) do3way = '$parent2' in args if revs and change: @@ -280,8 +280,7 @@ def uisetup(ui): cmd = cmd[4:] if not path: path = cmd - diffopts = ui.config('extdiff', 'opts.' + cmd, '') - diffopts = diffopts and [diffopts] or [] + diffopts = shlex.split(ui.config('extdiff', 'opts.' + cmd, '')) elif cmd.startswith('opts.'): continue else: diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t --- a/tests/test-extdiff.t +++ b/tests/test-extdiff.t @@ -19,6 +19,8 @@ Should diff cloned directories: $ echo "[extdiff]" >> $HGRCPATH $ echo "cmd.falabala=echo" >> $HGRCPATH $ echo "opts.falabala=diffing" >> $HGRCPATH + $ echo "cmd.edspace=echo" >> $HGRCPATH + $ echo 'opts.edspace="name "' >> $HGRCPATH $ hg falabala diffing a.000000000000 a @@ -168,6 +170,16 @@ Test extdiff with --option: diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) [1] +Test extdiff's handling of options with spaces in them: + + $ hg edspace -c 1 + name */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) + [1] + + $ hg extdiff -p echo -o "name " -c 1 + name */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) + [1] + Test with revsets: $ hg extdif -p echo -c "rev(1)"