~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-08 09:27:39 UTC
  • mfrom: (4934.4.5 504102-test-isolation)
  • Revision ID: pqm@pqm.ubuntu.com-20100108092739-ojag1uqo8uf5tief
(mbp) don't mutate RemoteBzrDirFormat._network_name as a side effect
        of initializing one

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
3108
3108
 
3109
3109
    def __init__(self):
3110
3110
        BzrDirMetaFormat1.__init__(self)
 
3111
        # XXX: It's a bit ugly that the network name is here, because we'd
 
3112
        # like to believe that format objects are stateless or at least
 
3113
        # immutable,  However, we do at least avoid mutating the name after
 
3114
        # it's returned.  See <https://bugs.edge.launchpad.net/bzr/+bug/504102>
3111
3115
        self._network_name = None
3112
3116
 
3113
3117
    def __repr__(self):
3256
3260
        args.append(self._serialize_NoneString(repo_format_name))
3257
3261
        args.append(self._serialize_NoneTrueFalse(make_working_trees))
3258
3262
        args.append(self._serialize_NoneTrueFalse(shared_repo))
3259
 
        if self._network_name is None:
3260
 
            self._network_name = \
 
3263
        request_network_name = self._network_name or \
3261
3264
            BzrDirFormat.get_default_format().network_name()
3262
3265
        try:
3263
3266
            response = client.call('BzrDirFormat.initialize_ex_1.16',
3264
 
                self.network_name(), path, *args)
 
3267
                request_network_name, path, *args)
3265
3268
        except errors.UnknownSmartMethod:
3266
3269
            client._medium._remember_remote_is_before((1,16))
3267
3270
            local_dir_format = BzrDirMetaFormat1()