Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 30681:caf7e1c5efe4
py3: have a bytes version of shlex.split()
shlex.split() only accepts unicodes on Python 3. After this patch we will be
using pycompat.shlexsplit(). This patch also replaces existing occurences of
shlex.split with pycompat.shlexsplit.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 25 Dec 2016 03:06:55 +0530 |
parents | b2be4ccaff1d |
children | b35e05103641 77eaf9539499 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Fri Dec 23 16:26:40 2016 +0000 +++ b/mercurial/dispatch.py Sun Dec 25 03:06:55 2016 +0530 @@ -14,7 +14,6 @@ import os import pdb import re -import shlex import signal import sys import time @@ -279,7 +278,7 @@ cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) givenargs = [x for i, x in enumerate(givenargs) if i not in nums] - args = shlex.split(cmd) + args = pycompat.shlexsplit(cmd) return args + givenargs def aliasinterpolate(name, args, cmd): @@ -351,7 +350,7 @@ return try: - args = shlex.split(self.definition) + args = pycompat.shlexsplit(self.definition) except ValueError as inst: self.badalias = (_("error in definition for alias '%s': %s") % (self.name, inst)) @@ -461,7 +460,7 @@ args = aliasargs(entry[0], args) defaults = ui.config("defaults", cmd) if defaults: - args = map(util.expandpath, shlex.split(defaults)) + args + args = map(util.expandpath, pycompat.shlexsplit(defaults)) + args c = list(entry[1]) else: cmd = None