/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/config.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-08-22 00:34:58 UTC
  • mfrom: (7067.12.5 python3-atomic)
  • Revision ID: breezy.the.bot@gmail.com-20180822003458-t8a5tmvru4yq9ou2
Fix an ignore test on Python 3.

Make AtomicFile a context manager.

Merged from https://code.launchpad.net/~jelmer/brz/python3-atomic/+merge/353125

Show diffs side-by-side

added added

removed removed

Lines of Context:
938
938
            raise AssertionError('We cannot save, self.file_name is None')
939
939
        conf_dir = os.path.dirname(self.file_name)
940
940
        ensure_config_dir_exists(conf_dir)
941
 
        atomic_file = atomicfile.AtomicFile(self.file_name)
942
 
        self._get_parser().write(atomic_file)
943
 
        atomic_file.commit()
944
 
        atomic_file.close()
 
941
        with atomicfile.AtomicFile(self.file_name) as atomic_file:
 
942
            self._get_parser().write(atomic_file)
945
943
        osutils.copy_ownership_from_path(self.file_name)
946
944
        for hook in OldConfigHooks['save']:
947
945
            hook(self)