Mercurial > hg
changeset 13818:bf6156bab41b
url: use url.url in url.open()
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 30 Mar 2011 20:01:34 -0700 |
parents | 7f18bab2c0b0 |
children | d16894e29f91 |
files | mercurial/url.py tests/test-bundle.t |
diffstat | 2 files changed, 12 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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