[Pkg-bazaar-commits] ./bzr/unstable r450: - Use urlgrabber by default
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:19:46 UTC 2009
------------------------------------------------------------
revno: 450
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-05-11 11:06:07 +1000
message:
- Use urlgrabber by default
modified:
bzrlib/remotebranch.py
-------------- next part --------------
=== modified file 'bzrlib/remotebranch.py'
--- a/bzrlib/remotebranch.py 2005-05-09 08:47:06 +0000
+++ b/bzrlib/remotebranch.py 2005-05-11 01:06:07 +0000
@@ -21,7 +21,6 @@
At the moment remote branches are only for HTTP and only for read
access.
-
"""
@@ -38,19 +37,7 @@
# breaks keep-alive -- sucks!
-
-ENABLE_URLGRABBER = False
-
-def get_url(url, compressed=False):
- import urllib2
- if compressed:
- url += '.gz'
- mutter("get_url %s" % url)
- url_f = urllib2.urlopen(url)
- if compressed:
- return gzip.GzipFile(fileobj=StringIO(url_f.read()))
- else:
- return url_f
+ENABLE_URLGRABBER = True
if ENABLE_URLGRABBER:
@@ -62,6 +49,7 @@
url = path
if compressed:
url += '.gz'
+ mutter("grab url %s" % url)
url_f = urlgrabber.urlopen(url, keepalive=1, close_connection=0)
if not compressed:
return url_f
@@ -69,6 +57,17 @@
return gzip.GzipFile(fileobj=StringIO(url_f.read()))
except urllib2.URLError, e:
raise BzrError("remote fetch failed: %r: %s" % (url, e))
+else:
+ def get_url(url, compressed=False):
+ import urllib2
+ if compressed:
+ url += '.gz'
+ mutter("get_url %s" % url)
+ url_f = urllib2.urlopen(url)
+ if compressed:
+ return gzip.GzipFile(fileobj=StringIO(url_f.read()))
+ else:
+ return url_f
More information about the Pkg-bazaar-commits
mailing list