[Pkg-bazaar-commits] ./bzr/unstable r142: better "unknowns" based on just listing the relevant files
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:50:15 UTC 2009
------------------------------------------------------------
revno: 142
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 17:29:29 +1000
message:
better "unknowns" based on just listing the relevant files
modified:
bzrlib/commands.py
bzrlib/inventory.py
bzrlib/tree.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-03-29 06:25:15 +0000
+++ b/bzrlib/commands.py 2005-03-29 07:29:29 +0000
@@ -414,7 +414,6 @@
## XXX: Slightly inefficient since this was already calculated
pat = tree.is_ignored(path)
print '%-50s %s' % (path, pat)
-
def cmd_lookup_revision(revno):
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2005-03-29 07:15:34 +0000
+++ b/bzrlib/inventory.py 2005-03-29 07:29:29 +0000
@@ -288,11 +288,10 @@
yield joinpath([name, cn]), cie
- def directories(self, include_root=True):
+ def directories(self):
"""Return (path, entry) pairs for all directories.
"""
- if include_root:
- yield '', None
+ yield '', self._root
for path, entry in self.iter_entries():
if entry.kind == 'directory':
yield path, entry
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2005-03-29 07:16:19 +0000
+++ b/bzrlib/tree.py 2005-03-29 07:29:29 +0000
@@ -234,8 +234,8 @@
- def unknowns(self, path='', dir_id=None):
- """Yield names of unknown files in this WorkingTree.
+ def unknowns(self):
+ """Yield all unknown files in this WorkingTree.
If there are any unknown directories then only the directory is
returned, not all its children. But if there are unknown files
@@ -243,9 +243,27 @@
Currently returned depth-first, sorted by name within directories.
"""
- for fpath, fclass, fkind, fid in self.list_files():
- if fclass == '?':
- yield fpath
+ ## TODO: Work from given directory downwards
+
+ for path, dir_entry in self.inventory.directories():
+ mutter("search for unknowns in %r" % path)
+ dirabs = self.abspath(path)
+ if not isdir(dirabs):
+ # e.g. directory deleted
+ continue
+
+ fl = []
+ for subf in os.listdir(dirabs):
+ if (subf != '.bzr'
+ and (subf not in dir_entry.children)):
+ fl.append(subf)
+
+ fl.sort()
+ for subf in fl:
+ subp = appendpath(path, subf)
+ if self.is_ignored(subp):
+ continue
+ yield subp
def ignored_files(self):
More information about the Pkg-bazaar-commits
mailing list