comparison hgext/convert/convcmd.py @ 36558:d4c98b6724e1

convcmd: use our shlex wrapper to avoid Python 3 tracebacks Differential Revision: https://phab.mercurial-scm.org/D2526
author Augie Fackler <augie@google.com>
date Thu, 01 Mar 2018 17:47:49 -0500
parents 93943eef696f
children c6061cadb400
comparison
equal deleted inserted replaced
36557:d60430dc7853 36558:d4c98b6724e1
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 from __future__ import absolute_import 7 from __future__ import absolute_import
8 8
9 import collections 9 import collections
10 import os 10 import os
11 import shlex
12 import shutil 11 import shutil
13 12
14 from mercurial.i18n import _ 13 from mercurial.i18n import _
15 from mercurial import ( 14 from mercurial import (
16 encoding, 15 encoding,
209 line = line.splitlines()[0].rstrip() 208 line = line.splitlines()[0].rstrip()
210 if not line: 209 if not line:
211 # Ignore blank lines 210 # Ignore blank lines
212 continue 211 continue
213 # split line 212 # split line
214 lex = shlex.shlex(line, posix=True) 213 lex = common.shlexer(data=line, whitespace=',')
215 lex.whitespace_split = True
216 lex.whitespace += ','
217 line = list(lex) 214 line = list(lex)
218 # check number of parents 215 # check number of parents
219 if not (2 <= len(line) <= 3): 216 if not (2 <= len(line) <= 3):
220 raise error.Abort(_('syntax error in %s(%d): child parent1' 217 raise error.Abort(_('syntax error in %s(%d): child parent1'
221 '[,parent2] expected') % (path, i + 1)) 218 '[,parent2] expected') % (path, i + 1))