diff mercurial/httprepo.py @ 13819:d16894e29f91

httprepo/sshrepo: use url.url Like the previous patch to getauthinfo(), this also makes username/password parsing more forgiving for SSH URLs. This also opens up the possibility of allowing non-numeric ports, since the URL parser has no problem handling them. Related issues: - issue851: @ in password in http url - issue2055: nonnumeric port bug with https protocol
author Brodie Rao <brodie@bitheap.org>
date Wed, 30 Mar 2011 20:01:35 -0700
parents 395a84f78736
children aaa9a5989405
line wrap: on
line diff
--- a/mercurial/httprepo.py	Wed Mar 30 20:01:34 2011 -0700
+++ b/mercurial/httprepo.py	Wed Mar 30 20:01:35 2011 -0700
@@ -9,7 +9,7 @@
 from node import nullid
 from i18n import _
 import changegroup, statichttprepo, error, url, util, wireproto
-import os, urllib, urllib2, urlparse, zlib, httplib
+import os, urllib, urllib2, zlib, httplib
 import errno, socket
 
 def zgenerator(f):
@@ -28,13 +28,13 @@
         self.path = path
         self.caps = None
         self.handler = None
-        scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
-        if query or frag:
+        u = url.url(path)
+        if u.query or u.fragment:
             raise util.Abort(_('unsupported URL component: "%s"') %
-                             (query or frag))
+                             (u.query or u.fragment))
 
         # urllib cannot handle URLs with embedded user or passwd
-        self._url, authinfo = url.getauthinfo(path)
+        self._url, authinfo = u.authinfo()
 
         self.ui = ui
         self.ui.debug('using %s\n' % self._url)