Rev 2336: WorkingTree4: Implement filter_unversioned_files to use dirstate bisection. in file:///home/robertc/source/baz/dirstate/
Robert Collins
robertc at robertcollins.net
Fri Feb 16 07:20:00 GMT 2007
At file:///home/robertc/source/baz/dirstate/
------------------------------------------------------------
revno: 2336
revision-id: robertc at robertcollins.net-20070216071959-8jibybk31injks6p
parent: robertc at robertcollins.net-20070216070433-1r4p40b7s3hecuks
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Fri 2007-02-16 18:19:59 +1100
message:
WorkingTree4: Implement filter_unversioned_files to use dirstate bisection.
modified:
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-02-16 06:59:50 +0000
+++ b/bzrlib/workingtree_4.py 2007-02-16 07:19:59 +0000
@@ -193,6 +193,26 @@
self._dirstate = dirstate.DirState.on_file(local_path)
return self._dirstate
+ def filter_unversioned_files(self, paths):
+ """Filter out paths that are not versioned.
+
+ :return: set of paths.
+ """
+ # TODO: make a generic multi-bisect routine roughly that should list
+ # the paths, then process one half at a time recursively, and feed the
+ # results of each bisect in further still
+ paths = sorted(paths)
+ result = set()
+ state = self.current_dirstate()
+ # TODO we want a paths_to_dirblocks helper I think
+ for path in paths:
+ dirname, basename = os.path.split(path.encode('utf8'))
+ _, _, _, path_is_versioned = state._get_block_row_index(
+ dirname, basename)
+ if path_is_versioned:
+ result.add(path)
+ return result
+
def flush(self):
"""Write all cached data to disk."""
if self._control_files._lock_mode != 'w':
More information about the bazaar-commits
mailing list