/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/object_store.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-29 15:50:22 UTC
  • mto: This revision was merged to the branch mainline in revision 7374.
  • Revision ID: jelmer@jelmer.uk-20190629155022-jagfuax2bl39bjin
Drop file id roundtripping support in Git.

Stashing bzr-specific metadata in Git is fraught with problems. Instead, we'll
be opportunistic when trying to match files from bzr and git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
492
492
        return self.mapping.export_commit(rev, tree_sha, parent_lookup,
493
493
                                          lossy, verifiers)
494
494
 
495
 
    def _create_fileid_map_blob(self, tree):
496
 
        # FIXME: This can probably be a lot more efficient,
497
 
        # not all files necessarily have to be processed.
498
 
        file_ids = {}
499
 
        for (path, ie) in tree.iter_entries_by_dir():
500
 
            if self.mapping.generate_file_id(path) != ie.file_id:
501
 
                file_ids[path] = ie.file_id
502
 
        return self.mapping.export_fileid_map(file_ids)
503
 
 
504
495
    def _revision_to_objects(self, rev, tree, lossy, add_cache_entry=None):
505
496
        """Convert a revision to a set of git objects.
506
497
 
530
521
                base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0])
531
522
                root_tree = self[self[base_sha1].tree]
532
523
            root_key_data = (tree.get_root_id(), tree.get_revision_id())
533
 
        if not lossy and self.mapping.BZR_FILE_IDS_FILE is not None:
534
 
            b = self._create_fileid_map_blob(tree)
535
 
            if b is not None:
536
 
                root_tree[self.mapping.BZR_FILE_IDS_FILE] = (
537
 
                    (stat.S_IFREG | 0o644), b.id)
538
 
                yield self.mapping.BZR_FILE_IDS_FILE, b
539
524
        if add_cache_entry is not None:
540
525
            add_cache_entry(root_tree, root_key_data, "")
541
526
        yield "", root_tree
632
617
            bzr_tree.iter_child_entries(path),
633
618
            get_ie_sha1, unusual_modes, self.mapping.BZR_DUMMY_FILE,
634
619
            bzr_tree.get_root_id() == fileid)
635
 
        if (bzr_tree.get_root_id() == fileid and
636
 
                self.mapping.BZR_FILE_IDS_FILE is not None):
637
 
            if tree is None:
638
 
                tree = Tree()
639
 
            b = self._create_fileid_map_blob(bzr_tree)
640
 
            # If this is the root tree, add the file ids
641
 
            tree[self.mapping.BZR_FILE_IDS_FILE] = (
642
 
                (stat.S_IFREG | 0o644), b.id)
643
620
        if tree is not None:
644
621
            _check_expected_sha(expected_sha, tree)
645
622
        return tree