130
128
RENAMED = 'renamed'
131
129
MODIFIED_AND_RENAMED = 'modified and renamed'
131
__slots__ = ['file_id', 'revision', 'parent_id', 'name']
133
# Attributes that all InventoryEntry instances are expected to have, but
134
# that don't vary for all kinds of entry. (e.g. symlink_target is only
135
# relevant to InventoryLink, so there's no reason to make every
136
# InventoryFile instance allocate space to hold a value for it.)
137
# Attributes that only vary for files: executable, text_sha1, text_size,
143
# Attributes that only vary for symlinks: symlink_target
144
symlink_target = None
145
# Attributes that only vary for tree-references: reference_revision
146
reference_revision = None
135
149
def detect_changes(self, old_entry):
136
150
"""Return a (text_modified, meta_modified) from this to old_entry.
231
229
known_kinds = ('file', 'directory', 'symlink')
233
def _put_in_tar(self, item, tree):
234
"""populate item for stashing in a tar, and return the content stream.
236
If no content is available, return None.
238
raise BzrError("don't know how to export {%s} of kind %r" %
239
(self.file_id, self.kind))
241
@deprecated_method(deprecated_in((1, 6, 0)))
242
def put_on_disk(self, dest, dp, tree):
243
"""Create a representation of self on disk in the prefix dest.
245
This is a template method - implement _put_on_disk in subclasses.
247
fullpath = osutils.pathjoin(dest, dp)
248
self._put_on_disk(fullpath, tree)
249
# mutter(" export {%s} kind %s to %s", self.file_id,
250
# self.kind, fullpath)
252
def _put_on_disk(self, fullpath, tree):
253
"""Put this entry onto disk at fullpath, from tree tree."""
254
raise BzrError("don't know how to export {%s} of kind %r" % (self.file_id, self.kind))
256
231
def sorted_children(self):
257
232
return sorted(self.children.items())
272
247
:param rev_id: Revision id from which this InventoryEntry was loaded.
273
248
Not necessarily the last-changed revision for this file.
274
249
:param inv: Inventory from which the entry was loaded.
275
:param tree: RevisionTree for this entry.
277
251
if self.parent_id is not None:
278
252
if not inv.has_id(self.parent_id):
279
253
raise BzrCheckError('missing parent {%s} in inventory for revision {%s}'
280
254
% (self.parent_id, rev_id))
281
self._check(checker, rev_id, tree)
255
checker._add_entry_to_text_key_references(inv, self)
256
self._check(checker, rev_id)
283
def _check(self, checker, rev_id, tree):
258
def _check(self, checker, rev_id):
284
259
"""Check this inventory entry for kind specific errors."""
285
raise BzrCheckError('unknown entry kind %r in revision {%s}' %
260
checker._report_items.append(
261
'unknown entry kind %r in revision {%s}' % (self.kind, rev_id))
289
264
"""Clone this inventory entry."""
399
class RootEntry(InventoryEntry):
401
__slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
402
'text_id', 'parent_id', 'children', 'executable',
403
'revision', 'symlink_target', 'reference_revision']
405
def _check(self, checker, rev_id, tree):
406
"""See InventoryEntry._check"""
408
def __init__(self, file_id):
409
self.file_id = file_id
411
self.kind = 'directory'
412
self.parent_id = None
415
symbol_versioning.warn('RootEntry is deprecated as of bzr 0.10.'
416
' Please use InventoryDirectory instead.',
417
DeprecationWarning, stacklevel=2)
419
def __eq__(self, other):
420
if not isinstance(other, RootEntry):
421
return NotImplemented
423
return (self.file_id == other.file_id) \
424
and (self.children == other.children)
427
374
class InventoryDirectory(InventoryEntry):
428
375
"""A directory in an inventory."""
430
__slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
431
'text_id', 'parent_id', 'children', 'executable',
432
'revision', 'symlink_target', 'reference_revision']
434
def _check(self, checker, rev_id, tree):
377
__slots__ = ['children']
381
def _check(self, checker, rev_id):
435
382
"""See InventoryEntry._check"""
436
if self.text_sha1 is not None or self.text_size is not None or self.text_id is not None:
437
raise BzrCheckError('directory {%s} has text in revision {%s}'
438
% (self.file_id, rev_id))
383
# In non rich root repositories we do not expect a file graph for the
385
if self.name == '' and not checker.rich_roots:
387
# Directories are stored as an empty file, but the file should exist
388
# to provide a per-fileid log. The hash of every directory content is
389
# "da..." below (the sha1sum of '').
390
checker.add_pending_item(rev_id,
391
('texts', self.file_id, self.revision), 'text',
392
'da39a3ee5e6b4b0d3255bfef95601890afd80709')
441
395
other = InventoryDirectory(self.file_id, self.name, self.parent_id)
447
401
def __init__(self, file_id, name, parent_id):
448
402
super(InventoryDirectory, self).__init__(file_id, name, parent_id)
449
403
self.children = {}
450
self.kind = 'directory'
452
405
def kind_character(self):
453
406
"""See InventoryEntry.kind_character."""
456
def _put_in_tar(self, item, tree):
457
"""See InventoryEntry._put_in_tar."""
458
item.type = tarfile.DIRTYPE
465
def _put_on_disk(self, fullpath, tree):
466
"""See InventoryEntry._put_on_disk."""
470
410
class InventoryFile(InventoryEntry):
471
411
"""A file in an inventory."""
473
__slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
474
'text_id', 'parent_id', 'children', 'executable',
475
'revision', 'symlink_target', 'reference_revision']
477
def _check(self, checker, tree_revision_id, tree):
413
__slots__ = ['text_sha1', 'text_size', 'text_id', 'executable']
417
def __init__(self, file_id, name, parent_id):
418
super(InventoryFile, self).__init__(file_id, name, parent_id)
419
self.text_sha1 = None
420
self.text_size = None
422
self.executable = False
424
def _check(self, checker, tree_revision_id):
478
425
"""See InventoryEntry._check"""
479
key = (self.file_id, self.revision)
480
if key in checker.checked_texts:
481
prev_sha = checker.checked_texts[key]
482
if prev_sha != self.text_sha1:
484
'mismatched sha1 on {%s} in {%s} (%s != %s) %r' %
485
(self.file_id, tree_revision_id, prev_sha, self.text_sha1,
488
checker.repeated_text_cnt += 1
491
checker.checked_text_cnt += 1
492
# We can't check the length, because Weave doesn't store that
493
# information, and the whole point of looking at the weave's
494
# sha1sum is that we don't have to extract the text.
495
if (self.text_sha1 != tree._repository.texts.get_sha1s([key])[key]):
496
raise BzrCheckError('text {%s} version {%s} wrong sha1' % key)
497
checker.checked_texts[key] = self.text_sha1
426
# TODO: check size too.
427
checker.add_pending_item(tree_revision_id,
428
('texts', self.file_id, self.revision), 'text',
430
if self.text_size is None:
431
checker._report_items.append(
432
'fileid {%s} in {%s} has None for text_size' % (self.file_id,
500
436
other = InventoryFile(self.file_id, self.name, self.parent_id)
532
468
"""See InventoryEntry.has_text."""
535
def __init__(self, file_id, name, parent_id):
536
super(InventoryFile, self).__init__(file_id, name, parent_id)
539
471
def kind_character(self):
540
472
"""See InventoryEntry.kind_character."""
543
def _put_in_tar(self, item, tree):
544
"""See InventoryEntry._put_in_tar."""
545
item.type = tarfile.REGTYPE
546
fileobj = tree.get_file(self.file_id)
547
item.size = self.text_size
548
if tree.is_executable(self.file_id):
554
def _put_on_disk(self, fullpath, tree):
555
"""See InventoryEntry._put_on_disk."""
556
osutils.pumpfile(tree.get_file(self.file_id), file(fullpath, 'wb'))
557
if tree.is_executable(self.file_id):
558
os.chmod(fullpath, 0755)
560
475
def _read_tree_state(self, path, work_tree):
561
476
"""See InventoryEntry._read_tree_state."""
562
477
self.text_sha1 = work_tree.get_file_sha1(self.file_id, path=path)
594
509
class InventoryLink(InventoryEntry):
595
510
"""A file in an inventory."""
597
__slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
598
'text_id', 'parent_id', 'children', 'executable',
599
'revision', 'symlink_target', 'reference_revision']
601
def _check(self, checker, rev_id, tree):
512
__slots__ = ['symlink_target']
516
def __init__(self, file_id, name, parent_id):
517
super(InventoryLink, self).__init__(file_id, name, parent_id)
518
self.symlink_target = None
520
def _check(self, checker, tree_revision_id):
602
521
"""See InventoryEntry._check"""
603
if self.text_sha1 is not None or self.text_size is not None or self.text_id is not None:
604
raise BzrCheckError('symlink {%s} has text in revision {%s}'
605
% (self.file_id, rev_id))
606
522
if self.symlink_target is None:
607
raise BzrCheckError('symlink {%s} has no target in revision {%s}'
608
% (self.file_id, rev_id))
523
checker._report_items.append(
524
'symlink {%s} has no target in revision {%s}'
525
% (self.file_id, tree_revision_id))
526
# Symlinks are stored as ''
527
checker.add_pending_item(tree_revision_id,
528
('texts', self.file_id, self.revision), 'text',
529
'da39a3ee5e6b4b0d3255bfef95601890afd80709')
611
532
other = InventoryLink(self.file_id, self.name, self.parent_id)
641
562
differ = DiffSymlink(old_tree, new_tree, output_to)
642
563
return differ.diff_symlink(old_target, new_target)
644
def __init__(self, file_id, name, parent_id):
645
super(InventoryLink, self).__init__(file_id, name, parent_id)
646
self.kind = 'symlink'
648
565
def kind_character(self):
649
566
"""See InventoryEntry.kind_character."""
652
def _put_in_tar(self, item, tree):
653
"""See InventoryEntry._put_in_tar."""
654
item.type = tarfile.SYMTYPE
658
item.linkname = self.symlink_target
661
def _put_on_disk(self, fullpath, tree):
662
"""See InventoryEntry._put_on_disk."""
664
os.symlink(self.symlink_target, fullpath)
666
raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, self.symlink_target, e))
668
569
def _read_tree_state(self, path, work_tree):
669
570
"""See InventoryEntry._read_tree_state."""
670
571
self.symlink_target = work_tree.get_symlink_target(self.file_id)
947
869
descend(self.root, u'')
950
def path2id(self, name):
872
def path2id(self, relpath):
951
873
"""Walk down through directories to return entry of last component.
953
names may be either a list of path components, or a single
954
string, in which case it is automatically split.
875
:param relpath: may be either a list of path components, or a single
876
string, in which case it is automatically split.
956
878
This returns the entry of the last component in the path,
957
879
which may be either a file or a directory.
959
881
Returns None IFF the path is not found.
961
if isinstance(name, basestring):
962
name = osutils.splitpath(name)
964
# mutter("lookup path %r" % name)
883
if isinstance(relpath, basestring):
884
names = osutils.splitpath(relpath)
967
889
parent = self.root
1539
1464
raise ValueError("unknown kind %r" % entry.kind)
1466
def _expand_fileids_to_parents_and_children(self, file_ids):
1467
"""Give a more wholistic view starting with the given file_ids.
1469
For any file_id which maps to a directory, we will include all children
1470
of that directory. We will also include all directories which are
1471
parents of the given file_ids, but we will not include their children.
1478
fringle # fringle-id
1482
if given [foo-id] we will include
1483
TREE_ROOT as interesting parents
1485
foo-id, baz-id, frob-id, fringle-id
1489
# TODO: Pre-pass over the list of fileids to see if anything is already
1490
# deserialized in self._fileid_to_entry_cache
1492
directories_to_expand = set()
1493
children_of_parent_id = {}
1494
# It is okay if some of the fileids are missing
1495
for entry in self._getitems(file_ids):
1496
if entry.kind == 'directory':
1497
directories_to_expand.add(entry.file_id)
1498
interesting.add(entry.parent_id)
1499
children_of_parent_id.setdefault(entry.parent_id, []
1500
).append(entry.file_id)
1502
# Now, interesting has all of the direct parents, but not the
1503
# parents of those parents. It also may have some duplicates with
1505
remaining_parents = interesting.difference(file_ids)
1506
# When we hit the TREE_ROOT, we'll get an interesting parent of None,
1507
# but we don't actually want to recurse into that
1508
interesting.add(None) # this will auto-filter it in the loop
1509
remaining_parents.discard(None)
1510
while remaining_parents:
1511
next_parents = set()
1512
for entry in self._getitems(remaining_parents):
1513
next_parents.add(entry.parent_id)
1514
children_of_parent_id.setdefault(entry.parent_id, []
1515
).append(entry.file_id)
1516
# Remove any search tips we've already processed
1517
remaining_parents = next_parents.difference(interesting)
1518
interesting.update(remaining_parents)
1519
# We should probably also .difference(directories_to_expand)
1520
interesting.update(file_ids)
1521
interesting.discard(None)
1522
while directories_to_expand:
1523
# Expand directories by looking in the
1524
# parent_id_basename_to_file_id map
1525
keys = [StaticTuple(f,).intern() for f in directories_to_expand]
1526
directories_to_expand = set()
1527
items = self.parent_id_basename_to_file_id.iteritems(keys)
1528
next_file_ids = set([item[1] for item in items])
1529
next_file_ids = next_file_ids.difference(interesting)
1530
interesting.update(next_file_ids)
1531
for entry in self._getitems(next_file_ids):
1532
if entry.kind == 'directory':
1533
directories_to_expand.add(entry.file_id)
1534
children_of_parent_id.setdefault(entry.parent_id, []
1535
).append(entry.file_id)
1536
return interesting, children_of_parent_id
1538
def filter(self, specific_fileids):
1539
"""Get an inventory view filtered against a set of file-ids.
1541
Children of directories and parents are included.
1543
The result may or may not reference the underlying inventory
1544
so it should be treated as immutable.
1547
parent_to_children) = self._expand_fileids_to_parents_and_children(
1549
# There is some overlap here, but we assume that all interesting items
1550
# are in the _fileid_to_entry_cache because we had to read them to
1551
# determine if they were a dir we wanted to recurse, or just a file
1552
# This should give us all the entries we'll want to add, so start
1554
other = Inventory(self.root_id)
1555
other.root.revision = self.root.revision
1556
other.revision_id = self.revision_id
1557
if not interesting or not parent_to_children:
1558
# empty filter, or filtering entrys that don't exist
1559
# (if even 1 existed, then we would have populated
1560
# parent_to_children with at least the tree root.)
1562
cache = self._fileid_to_entry_cache
1563
remaining_children = collections.deque(parent_to_children[self.root_id])
1564
while remaining_children:
1565
file_id = remaining_children.popleft()
1567
if ie.kind == 'directory':
1568
ie = ie.copy() # We create a copy to depopulate the .children attribute
1569
# TODO: depending on the uses of 'other' we should probably alwyas
1570
# '.copy()' to prevent someone from mutating other and
1571
# invaliding our internal cache
1573
if file_id in parent_to_children:
1574
remaining_children.extend(parent_to_children[file_id])
1542
1578
def _bytes_to_utf8name_key(bytes):
1543
1579
"""Get the file_id, revision_id key out of bytes."""
1785
1822
raise errors.BzrError('Duplicate key in inventory: %r\n%r'
1786
1823
% (key, bytes))
1787
1824
info[key] = value
1788
revision_id = info['revision_id']
1789
root_id = info['root_id']
1790
search_key_name = info.get('search_key_name', 'plain')
1791
parent_id_basename_to_file_id = info.get(
1792
'parent_id_basename_to_file_id', None)
1825
revision_id = intern(info['revision_id'])
1826
root_id = intern(info['root_id'])
1827
search_key_name = intern(info.get('search_key_name', 'plain'))
1828
parent_id_basename_to_file_id = intern(info.get(
1829
'parent_id_basename_to_file_id', None))
1830
if not parent_id_basename_to_file_id.startswith('sha1:'):
1831
raise ValueError('parent_id_basename_to_file_id should be a sha1'
1832
' key not %r' % (parent_id_basename_to_file_id,))
1793
1833
id_to_entry = info['id_to_entry']
1834
if not id_to_entry.startswith('sha1:'):
1835
raise ValueError('id_to_entry should be a sha1'
1836
' key not %r' % (id_to_entry,))
1795
1838
result = CHKInventory(search_key_name)
1796
1839
result.revision_id = revision_id
1799
1842
result._search_key_name)
1800
1843
if parent_id_basename_to_file_id is not None:
1801
1844
result.parent_id_basename_to_file_id = chk_map.CHKMap(
1802
chk_store, (parent_id_basename_to_file_id,),
1845
chk_store, StaticTuple(parent_id_basename_to_file_id,),
1803
1846
search_key_func=search_key_func)
1805
1848
result.parent_id_basename_to_file_id = None
1807
result.id_to_entry = chk_map.CHKMap(chk_store, (id_to_entry,),
1850
result.id_to_entry = chk_map.CHKMap(chk_store,
1851
StaticTuple(id_to_entry,),
1808
1852
search_key_func=search_key_func)
1809
1853
if (result.revision_id,) != expected_revision_id:
1810
1854
raise ValueError("Mismatched revision id and expected: %r, %r" %
1874
1919
return self._bytes_to_entry(
1875
self.id_to_entry.iteritems([(file_id,)]).next()[1])
1920
self.id_to_entry.iteritems([StaticTuple(file_id,)]).next()[1])
1876
1921
except StopIteration:
1877
1922
# really we're passing an inventory, not a tree...
1878
1923
raise errors.NoSuchId(self, file_id)
1925
def _getitems(self, file_ids):
1926
"""Similar to __getitem__, but lets you query for multiple.
1928
The returned order is undefined. And currently if an item doesn't
1929
exist, it isn't included in the output.
1933
for file_id in file_ids:
1934
entry = self._fileid_to_entry_cache.get(file_id, None)
1936
remaining.append(file_id)
1938
result.append(entry)
1939
file_keys = [StaticTuple(f,).intern() for f in remaining]
1940
for file_key, value in self.id_to_entry.iteritems(file_keys):
1941
entry = self._bytes_to_entry(value)
1942
result.append(entry)
1943
self._fileid_to_entry_cache[entry.file_id] = entry
1880
1946
def has_id(self, file_id):
1881
1947
# Perhaps have an explicit 'contains' method on CHKMap ?
1882
1948
if self._fileid_to_entry_cache.get(file_id, None) is not None:
1884
return len(list(self.id_to_entry.iteritems([(file_id,)]))) == 1
1951
self.id_to_entry.iteritems([StaticTuple(file_id,)]))) == 1
1886
1953
def is_root(self, file_id):
1887
1954
return file_id == self.root_id
1917
1984
self._fileid_to_entry_cache[file_id] = ie
1987
def _preload_cache(self):
1988
"""Make sure all file-ids are in _fileid_to_entry_cache"""
1989
if self._fully_cached:
1990
return # No need to do it again
1991
# The optimal sort order is to use iteritems() directly
1992
cache = self._fileid_to_entry_cache
1993
for key, entry in self.id_to_entry.iteritems():
1995
if file_id not in cache:
1996
ie = self._bytes_to_entry(entry)
2000
last_parent_id = last_parent_ie = None
2001
pid_items = self.parent_id_basename_to_file_id.iteritems()
2002
for key, child_file_id in pid_items:
2003
if key == ('', ''): # This is the root
2004
if child_file_id != self.root_id:
2005
raise ValueError('Data inconsistency detected.'
2006
' We expected data with key ("","") to match'
2007
' the root id, but %s != %s'
2008
% (child_file_id, self.root_id))
2010
parent_id, basename = key
2011
ie = cache[child_file_id]
2012
if parent_id == last_parent_id:
2013
parent_ie = last_parent_ie
2015
parent_ie = cache[parent_id]
2016
if parent_ie.kind != 'directory':
2017
raise ValueError('Data inconsistency detected.'
2018
' An entry in the parent_id_basename_to_file_id map'
2019
' has parent_id {%s} but the kind of that object'
2020
' is %r not "directory"' % (parent_id, parent_ie.kind))
2021
if parent_ie._children is None:
2022
parent_ie._children = {}
2023
basename = basename.decode('utf-8')
2024
if basename in parent_ie._children:
2025
existing_ie = parent_ie._children[basename]
2026
if existing_ie != ie:
2027
raise ValueError('Data inconsistency detected.'
2028
' Two entries with basename %r were found'
2029
' in the parent entry {%s}'
2030
% (basename, parent_id))
2031
if basename != ie.name:
2032
raise ValueError('Data inconsistency detected.'
2033
' In the parent_id_basename_to_file_id map, file_id'
2034
' {%s} is listed as having basename %r, but in the'
2035
' id_to_entry map it is %r'
2036
% (child_file_id, basename, ie.name))
2037
parent_ie._children[basename] = ie
2038
self._fully_cached = True
1920
2040
def iter_changes(self, basis):
1921
2041
"""Generate a Tree.iter_changes change list between this and basis.
2016
2136
delta.append((old_path, new_path, file_id, entry))
2019
def path2id(self, name):
2139
def path2id(self, relpath):
2020
2140
"""See CommonInventory.path2id()."""
2021
2141
# TODO: perhaps support negative hits?
2022
result = self._path_to_fileid_cache.get(name, None)
2142
result = self._path_to_fileid_cache.get(relpath, None)
2023
2143
if result is not None:
2025
if isinstance(name, basestring):
2026
names = osutils.splitpath(name)
2145
if isinstance(relpath, basestring):
2146
names = osutils.splitpath(relpath)
2029
2149
current_id = self.root_id
2030
2150
if current_id is None:
2032
2152
parent_id_index = self.parent_id_basename_to_file_id
2033
2154
for basename in names:
2034
# TODO: Cache each path we figure out in this function.
2155
if cur_path is None:
2158
cur_path = cur_path + '/' + basename
2035
2159
basename_utf8 = basename.encode('utf8')
2036
key_filter = [(current_id, basename_utf8)]
2038
for (parent_id, name_utf8), file_id in parent_id_index.iteritems(
2039
key_filter=key_filter):
2040
if parent_id != current_id or name_utf8 != basename_utf8:
2041
raise errors.BzrError("corrupt inventory lookup! "
2042
"%r %r %r %r" % (parent_id, current_id, name_utf8,
2160
file_id = self._path_to_fileid_cache.get(cur_path, None)
2044
2161
if file_id is None:
2162
key_filter = [StaticTuple(current_id, basename_utf8)]
2163
items = parent_id_index.iteritems(key_filter)
2164
for (parent_id, name_utf8), file_id in items:
2165
if parent_id != current_id or name_utf8 != basename_utf8:
2166
raise errors.BzrError("corrupt inventory lookup! "
2167
"%r %r %r %r" % (parent_id, current_id, name_utf8,
2172
self._path_to_fileid_cache[cur_path] = file_id
2046
2173
current_id = file_id
2047
self._path_to_fileid_cache[name] = current_id
2048
2174
return current_id
2050
2176
def to_lines(self):
2055
2181
lines.append('search_key_name: %s\n' % (self._search_key_name,))
2056
2182
lines.append("root_id: %s\n" % self.root_id)
2057
2183
lines.append('parent_id_basename_to_file_id: %s\n' %
2058
self.parent_id_basename_to_file_id.key())
2184
(self.parent_id_basename_to_file_id.key()[0],))
2059
2185
lines.append("revision_id: %s\n" % self.revision_id)
2060
lines.append("id_to_entry: %s\n" % self.id_to_entry.key())
2186
lines.append("id_to_entry: %s\n" % (self.id_to_entry.key()[0],))
2062
2188
lines.append("revision_id: %s\n" % self.revision_id)
2063
2189
lines.append("root_id: %s\n" % self.root_id)
2064
2190
if self.parent_id_basename_to_file_id is not None:
2065
2191
lines.append('parent_id_basename_to_file_id: %s\n' %
2066
self.parent_id_basename_to_file_id.key())
2067
lines.append("id_to_entry: %s\n" % self.id_to_entry.key())
2192
(self.parent_id_basename_to_file_id.key()[0],))
2193
lines.append("id_to_entry: %s\n" % (self.id_to_entry.key()[0],))
2076
2202
class CHKInventoryDirectory(InventoryDirectory):
2077
2203
"""A directory in an inventory."""
2079
__slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
2080
'text_id', 'parent_id', '_children', 'executable',
2081
'revision', 'symlink_target', 'reference_revision',
2205
__slots__ = ['_children', '_chk_inventory']
2084
2207
def __init__(self, file_id, name, parent_id, chk_inventory):
2085
2208
# Don't call InventoryDirectory.__init__ - it isn't right for this
2087
2210
InventoryEntry.__init__(self, file_id, name, parent_id)
2088
2211
self._children = None
2089
self.kind = 'directory'
2090
2212
self._chk_inventory = chk_inventory