~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-09 12:34:00 UTC
  • mfrom: (6056.2.5 option-registry)
  • Revision ID: pqm@pqm.ubuntu.com-20110809123400-x521f2j9jkxx8ze2
(vila) Introduce OptionRegistry (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib import (
35
35
    bzrdir,
36
36
    cache_utf8,
37
 
    config,
38
37
    conflicts as _mod_conflicts,
39
38
    debug,
40
39
    dirstate,
77
76
 
78
77
class DirStateWorkingTree(InventoryWorkingTree):
79
78
 
 
79
    _DEFAULT_WORTH_SAVING_LIMIT = 10
 
80
 
80
81
    def __init__(self, basedir,
81
82
                 branch,
82
83
                 _control_files=None,
250
251
 
251
252
        :return: an integer. -1 means never save.
252
253
        """
253
 
        # FIXME: We want a WorkingTreeStack here -- vila 20110812
254
 
        conf = config.BranchStack(self.branch)
255
 
        return conf.get('bzr.workingtree.worth_saving_limit')
 
254
        config = self.branch.get_config()
 
255
        val = config.get_user_option('bzr.workingtree.worth_saving_limit')
 
256
        if val is None:
 
257
            val = self._DEFAULT_WORTH_SAVING_LIMIT
 
258
        else:
 
259
            try:
 
260
                val = int(val)
 
261
            except ValueError, e:
 
262
                trace.warning('Invalid config value for'
 
263
                              ' "bzr.workingtree.worth_saving_limit"'
 
264
                              ' value %r is not an integer.'
 
265
                              % (val,))
 
266
                val = self._DEFAULT_WORTH_SAVING_LIMIT
 
267
        return val
256
268
 
257
269
    def filter_unversioned_files(self, paths):
258
270
        """Filter out paths that are versioned.