~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Martin Pool
  • Date: 2005-09-12 09:00:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050912090011-97e81abfaeeb8948
- fix bug in Inventory.copy() 
  
  must copy inventory top-down so that directories are added before
  their children

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
 
278
278
    def copy(self):
279
279
        other = Inventory(self.root.file_id)
280
 
        for entry in self._byid.itervalues():
 
280
        # copy recursively so we know directories will be added before
 
281
        # their children.  There are more efficient ways than this...
 
282
        for path, entry in self.iter_entries():
281
283
            if entry == self.root:
282
284
                continue
283
285
            other.add(entry.copy())