Rev 2269: merge trunk in http://sourcefrog.net/bzr/tags
Martin Pool
mbp at sourcefrog.net
Thu Mar 1 07:15:56 GMT 2007
At http://sourcefrog.net/bzr/tags
------------------------------------------------------------
revno: 2269
revision-id: mbp at sourcefrog.net-20070301071555-lalebdbi2pltrdnj
parent: mbp at sourcefrog.net-20070301064729-1y0zb2ap6ntxm9d4
parent: pqm at pqm.ubuntu.com-20070301065357-e0804257b4f378cf
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: tags
timestamp: Thu 2007-03-01 18:15:55 +1100
message:
merge trunk
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
------------------------------------------------------------
revno: 2220.1.77.1.11
merged: pqm at pqm.ubuntu.com-20070301065357-e0804257b4f378cf
parent: pqm at pqm.ubuntu.com-20070301033137-9b87fdf211dc2e15
parent: bialix at ukr.net-20070228183916-p1eorz33v4zxy27m
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-03-01 06:53:57 +0000
message:
(bialix) win32: suppress IOError with errno=22 (Invalid argument)
when pipe is broken
------------------------------------------------------------
revno: 2220.1.77.1.7.2.1
merged: bialix at ukr.net-20070228183916-p1eorz33v4zxy27m
parent: pqm at pqm.ubuntu.com-20070228065654-50cafaf8459ede53
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: small.fixes
timestamp: Wed 2007-02-28 20:39:16 +0200
message:
Suppress IOError with errno=22 (Invalid argument) on win32 when pipe is broken
------------------------------------------------------------
revno: 2220.1.77.1.10
merged: pqm at pqm.ubuntu.com-20070301033137-9b87fdf211dc2e15
parent: pqm at pqm.ubuntu.com-20070301031900-28686aef0de59e43
parent: aaron.bentley at utoronto.ca-20070301030830-xpgobtx029lmo57h
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-03-01 03:31:37 +0000
message:
Fix #85305 by issuing an exception instead of a traceback.
------------------------------------------------------------
revno: 2220.1.74.3.3
merged: aaron.bentley at utoronto.ca-20070301030830-xpgobtx029lmo57h
parent: abentley at panoramicfeedback.com-20070228214044-nz9ahj9y1lr0a65q
parent: pqm at pqm.ubuntu.com-20070228211048-30e18ddd8dd9c205
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: bzr.ab.integration
timestamp: Wed 2007-02-28 22:08:30 -0500
message:
Merge bzr.dev
------------------------------------------------------------
revno: 2220.1.74.3.2
merged: abentley at panoramicfeedback.com-20070228214044-nz9ahj9y1lr0a65q
parent: v.ladeuil+lp at free.fr-20070217203103-5uepd1ux5jqvufaa
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's integration
timestamp: Wed 2007-02-28 16:40:44 -0500
message:
Remove trailing whitespace
------------------------------------------------------------
revno: 2220.1.74.3.1
merged: v.ladeuil+lp at free.fr-20070217203103-5uepd1ux5jqvufaa
parent: pqm at pqm.ubuntu.com-20070217025822-306d98c244b53b08
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bzr.85305
timestamp: Sat 2007-02-17 21:31:03 +0100
message:
Fix #85305 by issuing an exception instead of a traceback.
* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport.__init__): Check https support.
* bzrlib/tests/test_http.py:
(TestWithTransport_pycurl): Moved higher for reuse.
(TestHttpTransportUrls): Separated from TestHttpUrls to be applied
to both implementations (pycurl and urllib).
(TestHttpUrls_urllib, TestHttpUrls_pycurl):
------------------------------------------------------------
revno: 2220.1.77.1.9
merged: pqm at pqm.ubuntu.com-20070301031900-28686aef0de59e43
parent: pqm at pqm.ubuntu.com-20070228211048-30e18ddd8dd9c205
parent: aaron.bentley at utoronto.ca-20070301025337-ao2ls9hmiscidfg8
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-03-01 03:19:00 +0000
message:
fix pull --overwrite, especially with bundles
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.23
merged: aaron.bentley at utoronto.ca-20070301025337-ao2ls9hmiscidfg8
parent: abentley at panoramicfeedback.com-20070228213255-gezk6m0jc3p01uf3
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: Aaron's mergeable stuff
timestamp: Wed 2007-02-28 21:53:37 -0500
message:
Update test case per review
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.22
merged: abentley at panoramicfeedback.com-20070228213255-gezk6m0jc3p01uf3
parent: aaron.bentley at utoronto.ca-20070216001818-rlhrzftmlaune361
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Wed 2007-02-28 16:32:55 -0500
message:
Fix pull --overwrite for bundles
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.21
merged: aaron.bentley at utoronto.ca-20070216001818-rlhrzftmlaune361
parent: abentley at panoramicfeedback.com-20070215160031-a2tj0ie8u9v30ob9
parent: pqm at pqm.ubuntu.com-20070215181416-864dbe690a0f3da8
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: Aaron's mergeable stuff
timestamp: Thu 2007-02-15 19:18:18 -0500
message:
Merge from bzr.dev
=== modified file 'NEWS'
--- a/NEWS 2007-03-01 04:26:55 +0000
+++ b/NEWS 2007-03-01 07:15:55 +0000
@@ -151,6 +151,9 @@
* ``bzr init`` works with unicode argument LOCATION.
(Alexander Belchenko, #85599)
+ * Raise DependencyNotPresent if pycurl do not support https. (Vincent
+ Ladeuil, #85305)
+
TESTING:
* New ``--first`` option to ``bzr selftest`` to run specified tests
=== modified file 'bzr'
--- a/bzr 2007-02-20 07:16:27 +0000
+++ b/bzr 2007-02-28 18:39:16 +0000
@@ -104,7 +104,12 @@
# are just about to be discarded anyhow. This does mean that atexit hooks
# won't run but we don't use them. Also file buffers won't be flushed,
# but our policy is to always close files from a finally block. -- mbp 20070215
- sys.stdout.flush()
+ try:
+ sys.stdout.flush()
+ except IOError, e:
+ import errno
+ if sys.platform != 'win32' or e.errno != errno.EINVAL:
+ raise
if bzrlib.trace._trace_file:
# this is also _bzr_log
bzrlib.trace._trace_file.flush()
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2007-03-01 06:47:29 +0000
+++ b/bzrlib/branch.py 2007-03-01 07:15:55 +0000
@@ -1451,7 +1451,9 @@
if not overwrite:
raise
if overwrite:
- self.set_revision_history(source.revision_history())
+ if stop_revision is None:
+ stop_revision = source.last_revision()
+ self.generate_revision_history(stop_revision)
result.tag_conflicts = source.tags.merge_to(self.tags)
result.new_revno, result.new_revid = self.last_revision_info()
if _hook_master:
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2006-12-19 17:37:38 +0000
+++ b/bzrlib/commands.py 2007-02-28 18:39:16 +0000
@@ -627,7 +627,7 @@
raise
if e.errno != errno.EPIPE:
# Win32 raises IOError with errno=0 on a broken pipe
- if sys.platform != 'win32' or e.errno != 0:
+ if sys.platform != 'win32' or (e.errno not in (0, errno.EINVAL)):
raise
pass
except KeyboardInterrupt:
=== modified file 'bzrlib/tests/branch_implementations/test_pull.py'
--- a/bzrlib/tests/branch_implementations/test_pull.py 2007-03-01 04:15:28 +0000
+++ b/bzrlib/tests/branch_implementations/test_pull.py 2007-03-01 07:15:55 +0000
@@ -80,6 +80,19 @@
self.assertRaises(errors.BoundBranchConnectionFailure,
checkout.branch.pull, other.branch)
+ def test_pull_overwrite(self):
+ tree_a = self.make_branch_and_tree('tree_a')
+ tree_a.commit('message 1')
+ tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
+ tree_a.commit('message 2', rev_id='rev2a')
+ tree_b.commit('message 2', rev_id='rev2b')
+ self.assertRaises(errors.DivergedBranches, tree_a.pull, tree_b.branch)
+ tree_a.branch.pull(tree_a.branch, overwrite=True,
+ stop_revision='rev2b')
+ self.assertEqual('rev2b', tree_a.branch.last_revision())
+ self.assertEqual(tree_b.branch.revision_history(),
+ tree_a.branch.revision_history())
+
class TestPullHook(TestCaseWithBranch):
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py 2007-02-08 17:01:20 +0000
+++ b/bzrlib/tests/test_http.py 2007-02-28 21:40:44 +0000
@@ -126,10 +126,23 @@
self.port = None
+class TestWithTransport_pycurl(object):
+ """Test case to inherit from if pycurl is present"""
+
+ def _get_pycurl_maybe(self):
+ try:
+ from bzrlib.transport.http._pycurl import PyCurlTransport
+ return PyCurlTransport
+ except errors.DependencyNotPresent:
+ raise TestSkipped('pycurl not present')
+
+ _transport = property(_get_pycurl_maybe)
+
+
class TestHttpUrls(TestCase):
- # FIXME: Some of these tests should be done for both
- # implementations
+ # TODO: This should be moved to authorization tests once they
+ # are written.
def test_url_parsing(self):
f = FakeManager()
@@ -142,46 +155,102 @@
self.assertEquals([None, 'www.bazaar-vcs.org', 'user', 'pass'],
f.credentials[0])
+
+class TestHttpTransportUrls(object):
+ """Test the http urls.
+
+ This MUST be used by daughter classes that also inherit from
+ TestCase.
+
+ We can't inherit directly from TestCase or the
+ test framework will try to create an instance which cannot
+ run, its implementation being incomplete.
+ """
+
def test_abs_url(self):
"""Construction of absolute http URLs"""
- t = HttpTransport_urllib('http://bazaar-vcs.org/bzr/bzr.dev/')
+ t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
eq = self.assertEqualDiff
- eq(t.abspath('.'),
- 'http://bazaar-vcs.org/bzr/bzr.dev')
- eq(t.abspath('foo/bar'),
- 'http://bazaar-vcs.org/bzr/bzr.dev/foo/bar')
- eq(t.abspath('.bzr'),
- 'http://bazaar-vcs.org/bzr/bzr.dev/.bzr')
+ eq(t.abspath('.'), 'http://bazaar-vcs.org/bzr/bzr.dev')
+ eq(t.abspath('foo/bar'), 'http://bazaar-vcs.org/bzr/bzr.dev/foo/bar')
+ eq(t.abspath('.bzr'), 'http://bazaar-vcs.org/bzr/bzr.dev/.bzr')
eq(t.abspath('.bzr/1//2/./3'),
'http://bazaar-vcs.org/bzr/bzr.dev/.bzr/1/2/3')
def test_invalid_http_urls(self):
"""Trap invalid construction of urls"""
- t = HttpTransport_urllib('http://bazaar-vcs.org/bzr/bzr.dev/')
- self.assertRaises(ValueError,
- t.abspath,
- '.bzr/')
- t = HttpTransport_urllib('http://http://bazaar-vcs.org/bzr/bzr.dev/')
- self.assertRaises(errors.InvalidURL, t.has, 'foo/bar')
+ t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
+ self.assertRaises(ValueError, t.abspath, '.bzr/')
+ t = self._transport('http://http://bazaar-vcs.org/bzr/bzr.dev/')
+ self.assertRaises((errors.InvalidURL, errors.ConnectionError),
+ t.has, 'foo/bar')
def test_http_root_urls(self):
"""Construction of URLs from server root"""
- t = HttpTransport_urllib('http://bzr.ozlabs.org/')
+ t = self._transport('http://bzr.ozlabs.org/')
eq = self.assertEqualDiff
eq(t.abspath('.bzr/tree-version'),
'http://bzr.ozlabs.org/.bzr/tree-version')
def test_http_impl_urls(self):
"""There are servers which ask for particular clients to connect"""
- server = HttpServer_PyCurl()
+ server = self._server()
try:
server.setUp()
url = server.get_url()
- self.assertTrue(url.startswith('http+pycurl://'))
+ self.assertTrue(url.startswith('%s://' % self._qualified_prefix))
finally:
server.tearDown()
+class TestHttpUrls_urllib(TestHttpTransportUrls, TestCase):
+ """Test http urls with urllib"""
+
+ _transport = HttpTransport_urllib
+ _server = HttpServer_urllib
+ _qualified_prefix = 'http+urllib'
+
+
+class TestHttpUrls_pycurl(TestWithTransport_pycurl, TestHttpTransportUrls,
+ TestCase):
+ """Test http urls with pycurl"""
+
+ _server = HttpServer_PyCurl
+ _qualified_prefix = 'http+pycurl'
+
+ # TODO: This should really be moved into another pycurl
+ # specific test. When https tests will be implemented, take
+ # this one into account.
+ def test_pycurl_without_https_support(self):
+ """Test that pycurl without SSL do not fail with a traceback.
+
+ For the purpose of the test, we force pycurl to ignore
+ https by supplying a fake version_info that do not
+ support it.
+ """
+ try:
+ import pycurl
+ except ImportError:
+ raise TestSkipped('pycurl not present')
+ # Now that we have pycurl imported, we can fake its version_info
+ # This was taken from a windows pycurl without SSL
+ # (thanks to bialix)
+ pycurl.version_info = lambda : (2,
+ '7.13.2',
+ 462082,
+ 'i386-pc-win32',
+ 2576,
+ None,
+ 0,
+ None,
+ ('ftp', 'gopher', 'telnet',
+ 'dict', 'ldap', 'http', 'file'),
+ None,
+ 0,
+ None)
+ self.assertRaises(errors.DependencyNotPresent, self._transport,
+ 'https://launchpad.net')
+
class TestHttpConnections(object):
"""Test the http connections.
@@ -247,19 +316,6 @@
socket.setdefaulttimeout(default_timeout)
-class TestWithTransport_pycurl(object):
- """Test case to inherit from if pycurl is present"""
-
- def _get_pycurl_maybe(self):
- try:
- from bzrlib.transport.http._pycurl import PyCurlTransport
- return PyCurlTransport
- except errors.DependencyNotPresent:
- raise TestSkipped('pycurl not present')
-
- _transport = property(_get_pycurl_maybe)
-
-
class TestHttpConnections_urllib(TestHttpConnections, TestCaseWithWebserver):
"""Test http connections with urllib"""
=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py 2007-02-26 10:02:58 +0000
+++ b/bzrlib/transport/http/_pycurl.py 2007-03-01 03:08:30 +0000
@@ -81,6 +81,12 @@
def __init__(self, base, from_transport=None):
super(PyCurlTransport, self).__init__(base)
+ if base.startswith('https'):
+ # Check availability of https into pycurl supported
+ # protocols
+ supported = pycurl.version_info()[8]
+ if 'https' not in supported:
+ raise DependencyNotPresent('pycurl', 'no https support')
self.cabundle = ca_bundle.get_ca_path()
if from_transport is not None:
self._curl = from_transport._curl
More information about the bazaar-commits
mailing list