/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/repository.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-18 23:14:00 UTC
  • mfrom: (7490.40.62 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200718231400-jaes9qltn8oi8xss
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
884
884
        """
885
885
        raise NotImplementedError(self.iter_revisions)
886
886
 
887
 
    def get_deltas_for_revisions(self, revisions, specific_fileids=None):
888
 
        """Produce a generator of revision deltas.
889
 
 
890
 
        Note that the input is a sequence of REVISIONS, not revision_ids.
891
 
        Trees will be held in memory until the generator exits.
892
 
        Each delta is relative to the revision's lefthand predecessor.
893
 
 
894
 
        :param specific_fileids: if not None, the result is filtered
895
 
          so that only those file-ids, their parents and their
896
 
          children are included.
897
 
        """
898
 
        raise NotImplementedError(self.get_deltas_for_revisions)
899
 
 
900
887
    def get_revision_delta(self, revision_id):
901
888
        """Return the delta for one revision.
902
889
 
905
892
        """
906
893
        with self.lock_read():
907
894
            r = self.get_revision(revision_id)
908
 
            return list(self.get_deltas_for_revisions([r]))[0]
 
895
            return list(self.get_revision_deltas([r]))[0]
 
896
 
 
897
    def get_revision_deltas(self, revisions, specific_files=None):
 
898
        """Produce a generator of revision deltas.
 
899
 
 
900
        Note that the input is a sequence of REVISIONS, not revision ids.
 
901
        Trees will be held in memory until the generator exits.
 
902
        Each delta is relative to the revision's lefthand predecessor.
 
903
 
 
904
        specific_files should exist in the first revision.
 
905
 
 
906
        :param specific_files: if not None, the result is filtered
 
907
          so that only those files, their parents and their
 
908
          children are included.
 
909
        """
 
910
        from .tree import InterTree
 
911
        # Get the revision-ids of interest
 
912
        required_trees = set()
 
913
        for revision in revisions:
 
914
            required_trees.add(revision.revision_id)
 
915
            required_trees.update(revision.parent_ids[:1])
 
916
 
 
917
        trees = {
 
918
            t.get_revision_id(): t
 
919
            for t in self.revision_trees(required_trees)}
 
920
 
 
921
        # Calculate the deltas
 
922
        for revision in revisions:
 
923
            if not revision.parent_ids:
 
924
                old_tree = self.revision_tree(_mod_revision.NULL_REVISION)
 
925
            else:
 
926
                old_tree = trees[revision.parent_ids[0]]
 
927
            intertree = InterTree.get(old_tree, trees[revision.revision_id])
 
928
            yield intertree.compare(specific_files=specific_files)
 
929
            if specific_files is not None:
 
930
                specific_files = [
 
931
                    p for p in intertree.find_source_paths(
 
932
                        specific_files).values()
 
933
                    if p is not None]
909
934
 
910
935
    def store_revision_signature(self, gpg_strategy, plaintext, revision_id):
911
936
        raise NotImplementedError(self.store_revision_signature)
1504
1529
            try:
1505
1530
                self.target.set_make_working_trees(
1506
1531
                    self.source.make_working_trees())
1507
 
            except NotImplementedError:
 
1532
            except (NotImplementedError, errors.RepositoryUpgradeRequired):
1508
1533
                pass
1509
1534
            self.target.fetch(self.source, revision_id=revision_id)
1510
1535