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
40
Another note is that these objects are currently only used when there is
41
no InventoryEntry available - i.e. for unversioned objects.
42
Perhaps they should be UnversionedEntry et al. ? - RBC 20051003
45
def __eq__(self, other):
46
# yes, this us ugly, TODO: best practice __eq__ style.
47
return (isinstance(other, TreeEntry)
48
and other.__class__ == self.__class__)
50
def kind_character(self):
54
class TreeDirectory(TreeEntry):
55
"""See TreeEntry. This is a directory in a working tree."""
57
def __eq__(self, other):
58
return (isinstance(other, TreeDirectory)
59
and other.__class__ == self.__class__)
61
def kind_character(self):
65
class TreeFile(TreeEntry):
66
"""See TreeEntry. This is a regular file in a working tree."""
68
def __eq__(self, other):
69
return (isinstance(other, TreeFile)
70
and other.__class__ == self.__class__)
72
def kind_character(self):
76
class TreeLink(TreeEntry):
77
"""See TreeEntry. This is a symlink in a working tree."""
79
def __eq__(self, other):
80
return (isinstance(other, TreeLink)
81
and other.__class__ == self.__class__)
83
def kind_character(self):
32
87
class WorkingTree(bzrlib.tree.Tree):
33
88
"""Working copy tree.
186
241
% (fap, f_ie.kind, f_ie.file_id, fk))
188
yield fp, c, fk, (f_ie and f_ie.file_id)
243
# make a last minute entry
247
if fk == 'directory':
248
entry = TreeDirectory()
251
elif fk == 'symlink':
256
yield fp, c, fk, (f_ie and f_ie.file_id), entry
190
258
if fk != 'directory':