/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-02-13 23:57:28 UTC
  • mfrom: (7490 work)
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200213235728-m6ds0mm3mbs4y182
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
from .lazy_import import lazy_import
18
20
lazy_import(globals(), """
19
21
import time
884
886
        """
885
887
        raise NotImplementedError(self.iter_revisions)
886
888
 
 
889
    def get_deltas_for_revisions(self, revisions, specific_fileids=None):
 
890
        """Produce a generator of revision deltas.
 
891
 
 
892
        Note that the input is a sequence of REVISIONS, not revision_ids.
 
893
        Trees will be held in memory until the generator exits.
 
894
        Each delta is relative to the revision's lefthand predecessor.
 
895
 
 
896
        :param specific_fileids: if not None, the result is filtered
 
897
          so that only those file-ids, their parents and their
 
898
          children are included.
 
899
        """
 
900
        raise NotImplementedError(self.get_deltas_for_revisions)
 
901
 
887
902
    def get_revision_delta(self, revision_id):
888
903
        """Return the delta for one revision.
889
904
 
892
907
        """
893
908
        with self.lock_read():
894
909
            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]
 
910
            return list(self.get_deltas_for_revisions([r]))[0]
934
911
 
935
912
    def store_revision_signature(self, gpg_strategy, plaintext, revision_id):
936
913
        raise NotImplementedError(self.store_revision_signature)
1529
1506
            try:
1530
1507
                self.target.set_make_working_trees(
1531
1508
                    self.source.make_working_trees())
1532
 
            except (NotImplementedError, errors.RepositoryUpgradeRequired):
 
1509
            except NotImplementedError:
1533
1510
                pass
1534
1511
            self.target.fetch(self.source, revision_id=revision_id)
1535
1512