~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

(gz) Never raise KnownFailure in tests,
 use knownFailure method instead (Martin [gz])

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.
969
981
                    all_versioned = False
970
982
                    break
971
983
            if not all_versioned:
972
 
                raise errors.PathsNotVersionedError(
973
 
                    [p.decode('utf-8') for p in paths])
 
984
                raise errors.PathsNotVersionedError(paths)
974
985
        # -- remove redundancy in supplied paths to prevent over-scanning --
975
986
        search_paths = osutils.minimum_path_selection(paths)
976
987
        # sketch:
1025
1036
            found_dir_names = set(dir_name_id[:2] for dir_name_id in found)
1026
1037
            for dir_name in split_paths:
1027
1038
                if dir_name not in found_dir_names:
1028
 
                    raise errors.PathsNotVersionedError(
1029
 
                        [p.decode('utf-8') for p in paths])
 
1039
                    raise errors.PathsNotVersionedError(paths)
1030
1040
 
1031
1041
        for dir_name_id, trees_info in found.iteritems():
1032
1042
            for index in search_indexes:
1610
1620
    This format:
1611
1621
        - exists within a metadir controlling .bzr
1612
1622
        - includes an explicit version marker for the workingtree control
1613
 
          files, separate from the ControlDir format
 
1623
          files, separate from the BzrDir format
1614
1624
        - modifies the hash cache format
1615
1625
        - is new in bzr 0.15
1616
1626
        - uses a LockDir to guard access to it.
1851
1861
        # Make sure the file exists
1852
1862
        entry = self._get_entry(file_id, path=path)
1853
1863
        if entry == (None, None): # do we raise?
1854
 
            raise errors.NoSuchId(self, file_id)
 
1864
            return None
1855
1865
        parent_index = self._get_parent_index()
1856
1866
        last_changed_revision = entry[1][parent_index][4]
1857
1867
        try:
2176
2186
                path_entries = state._entries_for_path(path)
2177
2187
                if not path_entries:
2178
2188
                    # this specified path is not present at all: error
2179
 
                    not_versioned.append(path.decode('utf-8'))
 
2189
                    not_versioned.append(path)
2180
2190
                    continue
2181
2191
                found_versioned = False
2182
2192
                # for each id at this path
2190
2200
                if not found_versioned:
2191
2201
                    # none of the indexes was not 'absent' at all ids for this
2192
2202
                    # path.
2193
 
                    not_versioned.append(path.decode('utf-8'))
 
2203
                    not_versioned.append(path)
2194
2204
            if len(not_versioned) > 0:
2195
2205
                raise errors.PathsNotVersionedError(not_versioned)
2196
2206
        # -- remove redundancy in supplied specific_files to prevent over-scanning --