/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-05-24 00:42:36 UTC
  • mto: This revision was merged to the branch mainline in revision 7505.
  • Revision ID: jelmer@jelmer.uk-20200524004236-jdj6obo4k5lznqw2
Cleanup Windows functions.

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
 
887
900
    def get_revision_delta(self, revision_id):
888
901
        """Return the delta for one revision.
889
902
 
892
905
        """
893
906
        with self.lock_read():
894
907
            r = self.get_revision(revision_id)
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]
 
908
            return list(self.get_deltas_for_revisions([r]))[0]
934
909
 
935
910
    def store_revision_signature(self, gpg_strategy, plaintext, revision_id):
936
911
        raise NotImplementedError(self.store_revision_signature)
1529
1504
            try:
1530
1505
                self.target.set_make_working_trees(
1531
1506
                    self.source.make_working_trees())
1532
 
            except (NotImplementedError, errors.RepositoryUpgradeRequired):
 
1507
            except NotImplementedError:
1533
1508
                pass
1534
1509
            self.target.fetch(self.source, revision_id=revision_id)
1535
1510