13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
# FIXME: This refactoring of the workingtree code doesn't seem to keep
18
18
# the WorkingTree's copy of the inventory in sync with the branch. The
489
489
checker.repeated_text_cnt += 1
492
mutter('check version {%s} of {%s}', tree_revision_id, self.file_id)
493
492
checker.checked_text_cnt += 1
494
493
# We can't check the length, because Weave doesn't store that
495
494
# information, and the whole point of looking at the weave's
1339
1338
def is_root(self, file_id):
1340
1339
return self.root is not None and file_id == self.root.file_id
1341
def filter(self, specific_fileids):
1342
"""Get an inventory view filtered against a set of file-ids.
1344
Children of directories and parents are included.
1346
The result may or may not reference the underlying inventory
1347
so it should be treated as immutable.
1349
interesting_parents = set()
1350
for fileid in specific_fileids:
1352
interesting_parents.update(self.get_idpath(fileid))
1353
except errors.NoSuchId:
1354
# This fileid is not in the inventory - that's ok
1356
entries = self.iter_entries()
1357
if self.root is None:
1358
return Inventory(root_id=None)
1359
other = Inventory(entries.next()[1].file_id)
1360
other.root.revision = self.root.revision
1361
other.revision_id = self.revision_id
1362
directories_to_expand = set()
1363
for path, entry in entries:
1364
file_id = entry.file_id
1365
if (file_id in specific_fileids
1366
or entry.parent_id in directories_to_expand):
1367
if entry.kind == 'directory':
1368
directories_to_expand.add(file_id)
1369
elif file_id not in interesting_parents:
1371
other.add(entry.copy())
1343
1375
entry_factory = {
1344
1376
'directory': InventoryDirectory,