D2527: convert: use our shlex wrapper in filemap to avoid Python 3 tracebacks

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Mar 1 23:22:44 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2527

AFFECTED FILES
  hgext/convert/filemap.py

CHANGE DETAILS

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -7,7 +7,6 @@
 from __future__ import absolute_import, print_function
 
 import posixpath
-import shlex
 
 from mercurial.i18n import _
 from mercurial import (
@@ -71,8 +70,8 @@
                              (lex.infile, lex.lineno, listname, name))
                 return 1
             return 0
-        lex = shlex.shlex(open(path, 'rb'), path, True)
-        lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?'
+        lex = common.shlexer(
+            filepath=path, wordchars='!@#$%^&*()-=+[]{}|;:,./<>?')
         cmd = lex.get_token()
         while cmd:
             if cmd == 'include':



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list