~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-04 12:04:26 UTC
  • mfrom: (6161.1.9 863401-library-state)
  • Revision ID: pqm@pqm.ubuntu.com-20111004120426-cvloovom5oosl0q0
(vila) Don't crash while building a config stack if bzrlib.initialize() has
 not been called (workaround, not a license to generalise) (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    debug,
92
92
    errors,
93
93
    lazy_regex,
 
94
    library_state,
94
95
    lockdir,
95
96
    mail_client,
96
97
    mergetools,
3271
3272
        # Mostly for debugging use
3272
3273
        return "<config.%s(%s)>" % (self.__class__.__name__, id(self))
3273
3274
 
 
3275
    def _get_overrides(self):
 
3276
        # Hack around library_state.initialize never called
 
3277
        if bzrlib.global_state is not None:
 
3278
            return [bzrlib.global_state.cmdline_overrides]
 
3279
        return []
 
3280
 
3274
3281
 
3275
3282
class _CompatibleStack(Stack):
3276
3283
    """Place holder for compatibility with previous design.
3303
3310
        # Get a GlobalStore
3304
3311
        gstore = GlobalStore()
3305
3312
        super(GlobalStack, self).__init__(
3306
 
            [bzrlib.global_state.cmdline_overrides, gstore.get_sections],
 
3313
            [self._get_overrides, gstore.get_sections],
3307
3314
            gstore)
3308
3315
 
3309
3316
 
3318
3325
        matcher = LocationMatcher(lstore, location)
3319
3326
        gstore = GlobalStore()
3320
3327
        super(LocationStack, self).__init__(
3321
 
            [bzrlib.global_state.cmdline_overrides,
 
3328
            [self._get_overrides,
3322
3329
             matcher.get_sections, gstore.get_sections],
3323
3330
            lstore)
3324
3331
 
3332
3339
        matcher = LocationMatcher(lstore, branch.base)
3333
3340
        gstore = GlobalStore()
3334
3341
        super(BranchStack, self).__init__(
3335
 
            [bzrlib.global_state.cmdline_overrides,
 
3342
            [self._get_overrides,
3336
3343
             matcher.get_sections, bstore.get_sections, gstore.get_sections],
3337
3344
            bstore)
3338
3345
        self.branch = branch