/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/bzr/weave.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-24 00:39:50 UTC
  • mto: This revision was merged to the branch mainline in revision 7504.
  • Revision ID: jelmer@jelmer.uk-20200524003950-bbc545r76vc5yajg
Add github action.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
from ..errors import (
81
81
    RevisionAlreadyPresent,
82
82
    RevisionNotPresent,
 
83
    UnavailableRepresentation,
83
84
    )
84
85
from ..osutils import dirname, sha, sha_strings, split_lines
85
86
from ..revision import NULL_REVISION
88
89
    AbsentContentFactory,
89
90
    adapter_registry,
90
91
    ContentFactory,
91
 
    ExistingContent,
92
92
    sort_groupcompress,
93
 
    UnavailableRepresentation,
94
93
    VersionedFile,
95
94
    )
96
95
from .weavefile import _read_weave_v5, write_weave_v5
485
484
        if not sha1:
486
485
            sha1 = sha_strings(lines)
487
486
        if sha1 == nostore_sha:
488
 
            raise ExistingContent
 
487
            raise errors.ExistingContent
489
488
        if version_id is None:
490
489
            version_id = b"sha1:" + sha1
491
490
        if version_id in self._name_map:
582
581
    def _inclusions(self, versions):
583
582
        """Return set of all ancestors of given version(s)."""
584
583
        if not len(versions):
585
 
            return set()
 
584
            return []
586
585
        i = set(versions)
587
586
        for v in range(max(versions), 0, -1):
588
587
            if v in i:
595
594
        if isinstance(version_ids, bytes):
596
595
            version_ids = [version_ids]
597
596
        i = self._inclusions([self._lookup(v) for v in version_ids])
598
 
        return set(self._idx_to_name(v) for v in i)
 
597
        return [self._idx_to_name(v) for v in i]
599
598
 
600
599
    def _check_versions(self, indexes):
601
600
        """Check everything in the sequence of indexes is valid"""
676
675
 
677
676
        Weave lines present in none of them are skipped entirely.
678
677
        """
679
 
        inc_a = self.get_ancestry([ver_a])
680
 
        inc_b = self.get_ancestry([ver_b])
 
678
        inc_a = set(self.get_ancestry([ver_a]))
 
679
        inc_b = set(self.get_ancestry([ver_b]))
681
680
        inc_c = inc_a & inc_b
682
681
 
683
682
        for lineno, insert, deleteset, line in self._walk_internal(
861
860
            for p in self._parents[i]:
862
861
                new_inc.update(inclusions[self._idx_to_name(p)])
863
862
 
864
 
            if new_inc != self.get_ancestry(name):
 
863
            if set(new_inc) != set(self.get_ancestry(name)):
865
864
                raise AssertionError(
866
865
                    'failed %s != %s'
867
 
                    % (new_inc, self.get_ancestry(name)))
 
866
                    % (set(new_inc), set(self.get_ancestry(name))))
868
867
            inclusions[name] = new_inc
869
868
 
870
869
        nlines = len(self._weave)