~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Robert Collins
  • Date: 2006-09-07 07:31:51 UTC
  • mto: (1991.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1992.
  • Revision ID: robertc@robertcollins.net-20060907073151-24ad889e938b4b05
WorkingTree has a new api ``unversion`` which allow the unversioning of
entries by their file id. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1217
1217
    def has_id(self, file_id):
1218
1218
        return (file_id in self._byid)
1219
1219
 
 
1220
    def remove(self, file_id):
 
1221
        """Remove file_id, and children, from the inventory."""
 
1222
        to_find_delete = [self._byid[file_id]]
 
1223
        to_delete = []
 
1224
        while len(to_find_delete):
 
1225
            ie = to_find_delete.pop()
 
1226
            to_delete.append(ie.file_id)
 
1227
            if ie.kind == 'directory':
 
1228
                to_find_delete.extend(ie.children.values())
 
1229
        for file_id in reversed(to_delete):
 
1230
            del self._byid[file_id]
 
1231
 
1220
1232
    def rename(self, file_id, new_parent_id, new_name):
1221
1233
        """Move a file within the inventory.
1222
1234