~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

WorkingTree4: Implement filter_unversioned_files to use dirstate bisection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
        self._dirstate = dirstate.DirState.on_file(local_path)
194
194
        return self._dirstate
195
195
 
 
196
    def filter_unversioned_files(self, paths):
 
197
        """Filter out paths that are not versioned.
 
198
 
 
199
        :return: set of paths.
 
200
        """
 
201
        # TODO: make a generic multi-bisect routine roughly that should list
 
202
        # the paths, then process one half at a time recursively, and feed the
 
203
        # results of each bisect in further still
 
204
        paths = sorted(paths)
 
205
        result = set()
 
206
        state = self.current_dirstate()
 
207
        # TODO we want a paths_to_dirblocks helper I think
 
208
        for path in paths:
 
209
            dirname, basename = os.path.split(path.encode('utf8'))
 
210
            _, _, _, path_is_versioned = state._get_block_row_index(
 
211
                dirname, basename)
 
212
            if path_is_versioned:
 
213
                result.add(path)
 
214
        return result
 
215
 
196
216
    def flush(self):
197
217
        """Write all cached data to disk."""
198
218
        if self._control_files._lock_mode != 'w':