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

  • Committer: Martin Pool
  • Date: 2009-07-20 10:14:42 UTC
  • mto: This revision was merged to the branch mainline in revision 4566.
  • Revision ID: mbp@sourcefrog.net-20090720101442-o2mc2tdw9kx7e8bl
Remove RepositoryBase; make _has_same_location private

Show diffs side-by-side

added added

removed removed

Lines of Context:
849
849
# Repositories
850
850
 
851
851
 
852
 
class RepositoryBase(object):
853
 
    """Minimal base class for repositories.
854
 
 
855
 
    This class contains common methods for repository implementations, but 
856
 
    makes minimal assumptions about how they're implemented: native, remote,
857
 
    foreign, etc.
858
 
    """
859
 
 
860
 
    def has_same_fallbacks(self, other_repo):
861
 
        my_fb = self._fallback_repositories
862
 
        other_fb = other_repo._fallback_repositories
863
 
        if len(my_fb) != len(other_fb):
864
 
            return False
865
 
        for f, g in zip(my_fb, other_fb):
866
 
            if not f.has_same_location(g):
867
 
                return False
868
 
        return True
869
 
 
870
 
 
871
 
class Repository(RepositoryBase):
 
852
class Repository(object):
872
853
    """Repository holding history for one or more branches.
873
854
 
874
855
    The repository holds and retrieves historical information including
1212
1193
            return '%s(%r)' % (self.__class__.__name__,
1213
1194
                               self.base)
1214
1195
 
 
1196
    def _has_same_fallbacks(self, other_repo):
 
1197
        """Returns true if the repositories have the same fallbacks."""
 
1198
        my_fb = self._fallback_repositories
 
1199
        other_fb = other_repo._fallback_repositories
 
1200
        if len(my_fb) != len(other_fb):
 
1201
            return False
 
1202
        for f, g in zip(my_fb, other_fb):
 
1203
            if not f.has_same_location(g):
 
1204
                return False
 
1205
        return True
 
1206
 
1215
1207
    def has_same_location(self, other):
1216
1208
        """Returns a boolean indicating if this repository is at the same
1217
1209
        location as another repository.
1556
1548
                "May not fetch while in a write group.")
1557
1549
        # fast path same-url fetch operations
1558
1550
        # TODO: lift out to somewhere common with RemoteRepository
 
1551
        # <https://bugs.edge.launchpad.net/bzr/+bug/401646>
1559
1552
        if (self.has_same_location(source)
1560
1553
            and fetch_spec is None
1561
 
            and self.has_same_fallbacks(source)):
 
1554
            and self._has_same_fallbacks(source)):
1562
1555
            # check that last_revision is in 'from' and then return a
1563
1556
            # no-operation.
1564
1557
            if (revision_id is not None and