/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/plugins/git/tree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-15 19:05:51 UTC
  • mfrom: (6968 work)
  • mto: (6973.5.1 python3-c)
  • mto: This revision was merged to the branch mainline in revision 6984.
  • Revision ID: jelmer@jelmer.uk-20180515190551-epr5abd0mtxmrehr
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
        self._revision_id = revision_id
243
243
        self._repository = repository
244
244
        self.store = repository._git.object_store
245
 
        if type(revision_id) is not str:
 
245
        if not isinstance(revision_id, bytes):
246
246
            raise TypeError(revision_id)
247
247
        self.commit_id, self.mapping = repository.lookup_bzr_revision_id(revision_id)
248
248
        if revision_id == NULL_REVISION:
254
254
        else:
255
255
            try:
256
256
                commit = self.store[self.commit_id]
257
 
            except KeyError, r:
 
257
            except KeyError:
258
258
                raise errors.NoSuchRevision(repository, revision_id)
259
259
            self.tree = commit.tree
260
260
            self._fileid_map = self.mapping.get_fileid_map(self.store.__getitem__, self.tree)
573
573
 
574
574
 
575
575
def tree_delta_from_git_changes(changes, mapping,
576
 
        (old_fileid_map, new_fileid_map), specific_files=None,
 
576
        fileid_maps, specific_files=None,
577
577
        require_versioned=False, include_root=False,
578
578
        target_extras=None):
579
579
    """Create a TreeDelta from two git trees.
581
581
    source and target are iterators over tuples with:
582
582
        (filename, sha, mode)
583
583
    """
 
584
    (old_fileid_map, new_fileid_map) = fileid_maps
584
585
    if target_extras is None:
585
586
        target_extras = set()
586
587
    ret = delta.TreeDelta()
888
889
        self._index_dirty = True
889
890
 
890
891
    def _index_add_entry(self, path, kind, flags=0, reference_revision=None):
891
 
        if not isinstance(path, basestring):
892
 
            raise TypeError(path)
893
892
        if kind == "directory":
894
893
            # Git indexes don't contain directories
895
894
            return
901
900
                # TODO: Rather than come up with something here, use the old index
902
901
                file = BytesIO()
903
902
                stat_val = os.stat_result(
904
 
                    (stat.S_IFREG | 0644, 0, 0, 0, 0, 0, 0, 0, 0, 0))
 
903
                    (stat.S_IFREG | 0o644, 0, 0, 0, 0, 0, 0, 0, 0, 0))
905
904
            blob.set_raw_string(file.read())
906
905
            # Add object to the repository if it didn't exist yet
907
906
            if not blob.id in self.store: