~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-24 18:26:21 UTC
  • mfrom: (4567 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4568.
  • Revision ID: john@arbash-meinel.com-20090724182621-68s2jhoqf3pn72n7
Merge bzr.dev 4567 to resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
848
848
######################################################################
849
849
# Repositories
850
850
 
 
851
 
851
852
class Repository(object):
852
853
    """Repository holding history for one or more branches.
853
854
 
1183
1184
        self._inventory_entry_cache = fifo_cache.FIFOCache(10*1024)
1184
1185
 
1185
1186
    def __repr__(self):
1186
 
        return '%s(%r)' % (self.__class__.__name__,
1187
 
                           self.base)
 
1187
        if self._fallback_repositories:
 
1188
            return '%s(%r, fallback_repositories=%r)' % (
 
1189
                self.__class__.__name__,
 
1190
                self.base,
 
1191
                self._fallback_repositories)
 
1192
        else:
 
1193
            return '%s(%r)' % (self.__class__.__name__,
 
1194
                               self.base)
 
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
1188
1206
 
1189
1207
    def has_same_location(self, other):
1190
1208
        """Returns a boolean indicating if this repository is at the same
1529
1547
            raise errors.InternalBzrError(
1530
1548
                "May not fetch while in a write group.")
1531
1549
        # fast path same-url fetch operations
1532
 
        if self.has_same_location(source) and fetch_spec is None:
 
1550
        # TODO: lift out to somewhere common with RemoteRepository
 
1551
        # <https://bugs.edge.launchpad.net/bzr/+bug/401646>
 
1552
        if (self.has_same_location(source)
 
1553
            and fetch_spec is None
 
1554
            and self._has_same_fallbacks(source)):
1533
1555
            # check that last_revision is in 'from' and then return a
1534
1556
            # no-operation.
1535
1557
            if (revision_id is not None and