~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2009-04-14 02:35:07 UTC
  • mto: This revision was merged to the branch mainline in revision 4291.
  • Revision ID: robertc@robertcollins.net-20090414023507-935t0u7ab2rt7kfk
Add support for a RemoteBzrDirConfig to support optimising push operations which need to look for default stacking locations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1346
1346
 
1347
1347
class BzrDirConfig(object):
1348
1348
 
1349
 
    def __init__(self, transport):
1350
 
        self._config = TransportConfig(transport, 'control.conf')
 
1349
    def __init__(self, bzrdir):
 
1350
        self._bzrdir = bzrdir
 
1351
        self._config = bzrdir._get_config()
1351
1352
 
1352
1353
    def set_default_stack_on(self, value):
1353
1354
        """Set the default stacking location.
1357
1358
        This policy affects all branches contained by this bzrdir, except for
1358
1359
        those under repositories.
1359
1360
        """
 
1361
        if self._config is None:
 
1362
            raise errors.BzrError("Cannot set configuration in %s" % self._bzrdir)
1360
1363
        if value is None:
1361
1364
            self._config.set_option('', 'default_stack_on')
1362
1365
        else:
1370
1373
        This policy affects all branches contained by this bzrdir, except for
1371
1374
        those under repositories.
1372
1375
        """
 
1376
        if self._config is None:
 
1377
            return None
1373
1378
        value = self._config.get_option('default_stack_on')
1374
1379
        if value == '':
1375
1380
            value = None