~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Tim Penhey
  • Date: 2008-05-09 04:25:43 UTC
  • mto: (3473.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3474.
  • Revision ID: tim@penhey.net-20080509042543-71sp5fsk51buvaie
Updates from Aaron's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
    def unset_alias(self, alias_name):
457
457
        """Unset an existing alias."""
458
458
        aliases = self._get_parser().get('ALIASES')
459
 
        assert aliases and alias_name in aliases, (
460
 
            "The alias should exist before this is called")
 
459
        if not aliases or alias_name not in aliases:
 
460
            raise errors.NoSuchAlias(alias_name)
461
461
        del aliases[alias_name]
462
462
        self._writeConfigFile()
463
463
 
466
466
        # file lock on bazaar.conf.
467
467
        conf_dir = os.path.dirname(self._get_filename())
468
468
        ensure_config_dir_exists(conf_dir)
469
 
        if section not in self._get_parser():
470
 
            self._get_parser()[section] = {}
471
 
        self._get_parser()[section][option] = value
 
469
        self._get_parser().setdefault(section, {})[option] = value
472
470
        self._writeConfigFile()
473
471
 
474
472
    def _writeConfigFile(self):