diff mercurial/wireproto.py @ 28883:032c4c2f802a

pycompat: switch to util.urlreq/util.urlerr for py3 compat
author timeless <timeless@mozdev.org>
date Wed, 06 Apr 2016 23:22:12 +0000
parents ae53ecc47414
children 7996c3acc33b
line wrap: on
line diff
--- a/mercurial/wireproto.py	Thu Apr 07 00:05:48 2016 +0000
+++ b/mercurial/wireproto.py	Wed Apr 06 23:22:12 2016 +0000
@@ -11,7 +11,6 @@
 import os
 import sys
 import tempfile
-import urllib
 
 from .i18n import _
 from .node import (
@@ -31,6 +30,9 @@
     util,
 )
 
+urlerr = util.urlerr
+urlreq = util.urlreq
+
 bundle2required = _(
     'incompatible Mercurial client; bundle2 required\n'
     '(see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n')
@@ -287,7 +289,7 @@
             branchmap = {}
             for branchpart in d.splitlines():
                 branchname, branchheads = branchpart.split(' ', 1)
-                branchname = encoding.tolocal(urllib.unquote(branchname))
+                branchname = encoding.tolocal(urlreq.unquote(branchname))
                 branchheads = decodelist(branchheads)
                 branchmap[branchname] = branchheads
             yield branchmap
@@ -632,7 +634,7 @@
     branchmap = repo.branchmap()
     heads = []
     for branch, nodes in branchmap.iteritems():
-        branchname = urllib.quote(encoding.fromlocal(branch))
+        branchname = urlreq.quote(encoding.fromlocal(branch))
         branchnodes = encodelist(nodes)
         heads.append('%s %s' % (branchname, branchnodes))
     return '\n'.join(heads)
@@ -684,7 +686,7 @@
             caps.append('streamreqs=%s' % ','.join(sorted(requiredformats)))
     if repo.ui.configbool('experimental', 'bundle2-advertise', True):
         capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
-        caps.append('bundle2=' + urllib.quote(capsblob))
+        caps.append('bundle2=' + urlreq.quote(capsblob))
     caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority))
     caps.append(
         'httpheader=%d' % repo.ui.configint('server', 'maxhttpheaderlen', 1024))