~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/library_state.py

  • Committer: Vincent Ladeuil
  • Date: 2012-07-31 09:22:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6554.
  • Revision ID: v.ladeuil+lp@free.fr-20120731092202-qh9fs6q4p7y4qqmy
Stop using _CompatibleStack now that local config files can be
shared. Save changes when library state goes out of scope or, as a
fallback, when the process ends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
        # There is no overrides by default, they are set later when the command
77
77
        # arguments are parsed.
78
78
        self.cmdline_overrides = config.CommandLineStore()
 
79
        # No config stores are cached to start with
 
80
        self.config_stores = {} # By url
79
81
        self.started = False
80
82
 
81
83
    def __enter__(self):
106
108
        self.started = True
107
109
 
108
110
    def __exit__(self, exc_type, exc_val, exc_tb):
 
111
        if exc_type is None:
 
112
            # Save config changes
 
113
            for k, store in self.config_stores.iteritems():
 
114
                store.save_changes()
109
115
        self.cleanups.cleanup_now()
110
116
        trace._flush_stdout_stderr()
111
117
        trace._flush_trace()