Rev 4946: (mbp) don't mutate RemoteBzrDirFormat._network_name as a side effect in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jan 8 09:27:41 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4946 [merge]
revision-id: pqm at pqm.ubuntu.com-20100108092739-ojag1uqo8uf5tief
parent: pqm at pqm.ubuntu.com-20100108083722-nkd6usr60lfpgwib
parent: mbp at sourcefrog.net-20100108084330-k0u10122t0baveu6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-01-08 09:27:39 +0000
message:
(mbp) don't mutate RemoteBzrDirFormat._network_name as a side effect
of initializing one
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/tests/per_bzrdir/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
=== modified file 'NEWS'
--- a/NEWS 2010-01-08 07:37:25 +0000
+++ b/NEWS 2010-01-08 09:27:39 +0000
@@ -61,6 +61,10 @@
returns ``EINTR`` by calling ``PyErr_CheckSignals``. This affected the
optional ``_readdir_pyx`` extension. (Andrew Bennetts, #495023)
+* Fixed a side effect mutation of ``RemoteBzrDirFormat._network_name``
+ that caused some tests to fail when run in a non-default order.
+ Probably no user impact. (Martin Pool, #504102)
+
* FTP transports support Unicode paths by encoding/decoding them as utf8.
(Vincent Ladeuil, #472161)
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2010-01-08 07:37:25 +0000
+++ b/bzrlib/bzrdir.py 2010-01-08 09:27:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
+# Copyright (C) 2005-2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -3108,6 +3108,10 @@
def __init__(self):
BzrDirMetaFormat1.__init__(self)
+ # XXX: It's a bit ugly that the network name is here, because we'd
+ # like to believe that format objects are stateless or at least
+ # immutable, However, we do at least avoid mutating the name after
+ # it's returned. See <https://bugs.edge.launchpad.net/bzr/+bug/504102>
self._network_name = None
def __repr__(self):
@@ -3256,12 +3260,11 @@
args.append(self._serialize_NoneString(repo_format_name))
args.append(self._serialize_NoneTrueFalse(make_working_trees))
args.append(self._serialize_NoneTrueFalse(shared_repo))
- if self._network_name is None:
- self._network_name = \
+ request_network_name = self._network_name or \
BzrDirFormat.get_default_format().network_name()
try:
response = client.call('BzrDirFormat.initialize_ex_1.16',
- self.network_name(), path, *args)
+ request_network_name, path, *args)
except errors.UnknownSmartMethod:
client._medium._remember_remote_is_before((1,16))
local_dir_format = BzrDirMetaFormat1()
=== modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py'
--- a/bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-11-18 17:10:41 +0000
+++ b/bzrlib/tests/per_bzrdir/test_bzrdir.py 2010-01-08 06:28:53 +0000
@@ -1176,6 +1176,13 @@
# because the default open will not open them and
# they may not be initializable.
return
+ # for remote formats, there must be no prior assumption about the
+ # network name to use - it's possible that this may somehow have got
+ # in through an unisolated test though - see
+ # <https://bugs.edge.launchpad.net/bzr/+bug/504102>
+ self.assertEquals(getattr(self.bzrdir_format,
+ '_network_name', None),
+ None)
# supported formats must be able to init and open
t = get_transport(self.get_url())
readonly_t = get_transport(self.get_readonly_url())
More information about the bazaar-commits
mailing list