# HG changeset patch # User Brodie Rao # Date 1301540494 25200 # Node ID bf6156bab41b3f1edc0cb34e3a7ddb06bc63f304 # Parent 7f18bab2c0b0db634aa001a02ac7b7d68ad6fc3d url: use url.url in url.open() diff -r 7f18bab2c0b0 -r bf6156bab41b mercurial/url.py --- a/mercurial/url.py Wed Mar 30 20:01:31 2011 -0700 +++ b/mercurial/url.py Wed Mar 30 20:01:34 2011 -0700 @@ -7,7 +7,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import urllib, urllib2, urlparse, httplib, os, re, socket, cStringIO +import urllib, urllib2, urlparse, httplib, os, socket, cStringIO import __builtin__ from i18n import _ import keepalive, util @@ -961,17 +961,13 @@ opener.addheaders.append(('Accept', 'application/mercurial-0.1')) return opener -scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://') - -def open(ui, url, data=None): - scheme = None - m = scheme_re.search(url) - if m: - scheme = m.group(1).lower() - if not scheme: - path = util.normpath(os.path.abspath(url)) - url = 'file://' + urllib.pathname2url(path) +def open(ui, url_, data=None): + u = url(url_) + if u.scheme: + u.scheme = u.scheme.lower() + url_, authinfo = u.authinfo() + else: + path = util.normpath(os.path.abspath(url_)) + url_ = 'file://' + urllib.pathname2url(path) authinfo = None - else: - url, authinfo = getauthinfo(url) - return opener(ui, authinfo).open(url, data) + return opener(ui, authinfo).open(url_, data) diff -r 7f18bab2c0b0 -r bf6156bab41b tests/test-bundle.t --- a/tests/test-bundle.t Wed Mar 30 20:01:31 2011 -0700 +++ b/tests/test-bundle.t Wed Mar 30 20:01:34 2011 -0700 @@ -206,7 +206,7 @@ hg -R bundle://../full.hg verify $ hg pull bundle://../full.hg - pulling from bundle://../full.hg + pulling from bundle:../full.hg requesting all changes adding changesets adding manifests @@ -310,7 +310,7 @@ Incoming full.hg in partial $ hg incoming bundle://../full.hg - comparing with bundle://../full.hg + comparing with bundle:../full.hg searching for changes changeset: 4:095197eb4973 parent: 0:f9ee2f85a263