29
29
from bzrlib.errors import BzrCheckError
30
30
from bzrlib.trace import mutter
32
class TreeEntry(object):
33
"""An entry that implements the minium interface used by commands.
35
This needs further inspection, it may be better to have
36
InventoryEntries without ids - though that seems wrong. For now,
37
this is a parallel hierarchy to InventoryEntry, and needs to become
38
one of several things: decorates to that hierarchy, children of, or
42
def __eq__(self, other):
43
# yes, this us ugly, TODO: best practice __eq__ style.
44
return (isinstance(other, TreeEntry)
45
and other.__class__ == self.__class__)
47
def kind_character(self):
51
class TreeDirectory(TreeEntry):
52
"""See TreeEntry. This is a directory in a working tree."""
54
def __eq__(self, other):
55
return (isinstance(other, TreeDirectory)
56
and other.__class__ == self.__class__)
58
def kind_character(self):
62
class TreeFile(TreeEntry):
63
"""See TreeEntry. This is a regular file in a working tree."""
65
def __eq__(self, other):
66
return (isinstance(other, TreeFile)
67
and other.__class__ == self.__class__)
69
def kind_character(self):
73
class TreeLink(TreeEntry):
74
"""See TreeEntry. This is a symlink in a working tree."""
76
def __eq__(self, other):
77
return (isinstance(other, TreeLink)
78
and other.__class__ == self.__class__)
80
def kind_character(self):
32
84
class WorkingTree(bzrlib.tree.Tree):
33
85
"""Working copy tree.
186
238
% (fap, f_ie.kind, f_ie.file_id, fk))
188
yield fp, c, fk, (f_ie and f_ie.file_id)
240
# make a last minute entry
244
if fk == 'directory':
245
entry = TreeDirectory()
248
elif fk == 'symlink':
253
yield fp, c, fk, (f_ie and f_ie.file_id), entry
190
255
if fk != 'directory':