~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/bundle_data.py

  • Committer: Aaron Bentley
  • Date: 2007-02-06 14:52:16 UTC
  • mfrom: (2266 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2268.
  • Revision ID: abentley@panoramicfeedback.com-20070206145216-fcpi8o3ufvuzwbp9
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
648
648
 
649
649
        assert self.base_tree is not None
650
650
        base_inv = self.base_tree.inventory
651
 
        root_id = base_inv.root.file_id
652
 
        try:
653
 
            # New inventories have a unique root_id
654
 
            inv = Inventory(root_id, self.revision_id)
655
 
        except TypeError:
656
 
            inv = Inventory(revision_id=self.revision_id)
657
 
        inv.root.revision = self.get_last_changed(root_id)
 
651
        inv = Inventory(None, self.revision_id)
658
652
 
659
653
        def add_entry(file_id):
660
654
            path = self.id2path(file_id)
661
655
            if path is None:
662
656
                return
663
 
            parent_path = dirname(path)
664
 
            if parent_path == u'':
665
 
                parent_id = root_id
 
657
            if path == '':
 
658
                parent_id = None
666
659
            else:
 
660
                parent_path = dirname(path)
667
661
                parent_id = self.path2id(parent_path)
668
662
 
669
663
            kind = self.get_kind(file_id)
690
684
 
691
685
        sorted_entries = self.sorted_path_id()
692
686
        for path, file_id in sorted_entries:
693
 
            if file_id == inv.root.file_id:
694
 
                continue
695
687
            add_entry(file_id)
696
688
 
697
689
        return inv