~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Parth Malwankar
  • Date: 2010-05-05 14:11:13 UTC
  • mfrom: (5211 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5213.
  • Revision ID: parth.malwankar@gmail.com-20100505141113-c21oicoxzb3u6if6
merged in changes from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
643
643
        return self._custom_format._serializer
644
644
 
645
645
 
646
 
class RemoteRepository(_RpcHelper, lock._RelockDebugMixin):
 
646
class RemoteRepository(_RpcHelper, lock._RelockDebugMixin,
 
647
    bzrdir.ControlComponent):
647
648
    """Repository accessed over rpc.
648
649
 
649
650
    For the moment most operations are performed using local transport-backed
692
693
        # Additional places to query for data.
693
694
        self._fallback_repositories = []
694
695
 
 
696
    @property
 
697
    def user_transport(self):
 
698
        return self.bzrdir.user_transport
 
699
 
 
700
    @property
 
701
    def control_transport(self):
 
702
        # XXX: Normally you shouldn't directly get at the remote repository
 
703
        # transport, but I'm not sure it's worth making this method
 
704
        # optional -- mbp 2010-04-21
 
705
        return self.bzrdir.get_repository_transport(None)
 
706
        
695
707
    def __str__(self):
696
708
        return "%s(%s)" % (self.__class__.__name__, self.base)
697
709
 
1234
1246
        # _real_branch had its get_stacked_on_url method called), then the
1235
1247
        # repository to be added may already be in the _real_repositories list.
1236
1248
        if self._real_repository is not None:
1237
 
            fallback_locations = [repo.bzrdir.root_transport.base for repo in
 
1249
            fallback_locations = [repo.user_url for repo in
1238
1250
                self._real_repository._fallback_repositories]
1239
 
            if repository.bzrdir.root_transport.base not in fallback_locations:
 
1251
            if repository.user_url not in fallback_locations:
1240
1252
                self._real_repository.add_fallback_repository(repository)
1241
1253
 
1242
1254
    def _check_fallback_repository(self, repository):
1294
1306
        return self._real_repository.make_working_trees()
1295
1307
 
1296
1308
    def refresh_data(self):
1297
 
        """Re-read any data needed to to synchronise with disk.
 
1309
        """Re-read any data needed to synchronise with disk.
1298
1310
 
1299
1311
        This method is intended to be called after another repository instance
1300
1312
        (such as one used by a smart server) has inserted data into the
1301
 
        repository. It may not be called during a write group, but may be
1302
 
        called at any other time.
 
1313
        repository. On all repositories this will work outside of write groups.
 
1314
        Some repository formats (pack and newer for bzrlib native formats)
 
1315
        support refresh_data inside write groups. If called inside a write
 
1316
        group on a repository that does not support refreshing in a write group
 
1317
        IsInWriteGroupError will be raised.
1303
1318
        """
1304
 
        if self.is_in_write_group():
1305
 
            raise errors.InternalBzrError(
1306
 
                "May not refresh_data while in a write group.")
1307
1319
        if self._real_repository is not None:
1308
1320
            self._real_repository.refresh_data()
1309
1321
 
2181
2193
            self._real_branch = None
2182
2194
        # Fill out expected attributes of branch for bzrlib API users.
2183
2195
        self._clear_cached_state()
2184
 
        self.base = self.bzrdir.root_transport.base
 
2196
        # TODO: deprecate self.base in favor of user_url
 
2197
        self.base = self.bzrdir.user_url
2185
2198
        self._name = name
2186
2199
        self._control_files = None
2187
2200
        self._lock_mode = None