~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Andrew Bennetts
  • Date: 2010-04-29 05:52:35 UTC
  • mfrom: (5192 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5193.
  • Revision ID: andrew.bennetts@canonical.com-20100429055235-24e81jfdse3h3ugt
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
864
864
# Repositories
865
865
 
866
866
 
867
 
class Repository(_RelockDebugMixin):
 
867
class Repository(_RelockDebugMixin, bzrdir.ControlComponent):
868
868
    """Repository holding history for one or more branches.
869
869
 
870
870
    The repository holds and retrieves historical information including
1291
1291
 
1292
1292
        :param _format: The format of the repository on disk.
1293
1293
        :param a_bzrdir: The BzrDir of the repository.
1294
 
 
1295
 
        In the future we will have a single api for all stores for
1296
 
        getting file texts, inventories and revisions, then
1297
 
        this construct will accept instances of those things.
1298
1294
        """
 
1295
        # In the future we will have a single api for all stores for
 
1296
        # getting file texts, inventories and revisions, then
 
1297
        # this construct will accept instances of those things.
1299
1298
        super(Repository, self).__init__()
1300
1299
        self._format = _format
1301
1300
        # the following are part of the public API for Repository:
1316
1315
        # rather copying them?
1317
1316
        self._safe_to_return_from_cache = False
1318
1317
 
 
1318
    @property
 
1319
    def user_transport(self):
 
1320
        return self.bzrdir.user_transport
 
1321
 
 
1322
    @property
 
1323
    def control_transport(self):
 
1324
        return self._transport
 
1325
 
1319
1326
    def __repr__(self):
1320
1327
        if self._fallback_repositories:
1321
1328
            return '%s(%r, fallback_repositories=%r)' % (
1469
1476
 
1470
1477
        # now gather global repository information
1471
1478
        # XXX: This is available for many repos regardless of listability.
1472
 
        if self.bzrdir.root_transport.listable():
 
1479
        if self.user_transport.listable():
1473
1480
            # XXX: do we want to __define len__() ?
1474
1481
            # Maybe the versionedfiles object should provide a different
1475
1482
            # method to get the number of keys.
1507
1514
 
1508
1515
        ret = []
1509
1516
        for branches, repository in bzrdir.BzrDir.find_bzrdirs(
1510
 
                self.bzrdir.root_transport, evaluate=Evaluator()):
 
1517
                self.user_transport, evaluate=Evaluator()):
1511
1518
            if branches is not None:
1512
1519
                ret.extend(branches)
1513
1520
            if not using and repository is not None:
3171
3178
        """
3172
3179
        raise NotImplementedError(self.open)
3173
3180
 
 
3181
    def _run_post_repo_init_hooks(self, repository, a_bzrdir, shared):
 
3182
        from bzrlib.bzrdir import BzrDir, RepoInitHookParams
 
3183
        hooks = BzrDir.hooks['post_repo_init']
 
3184
        if not hooks:
 
3185
            return
 
3186
        params = RepoInitHookParams(repository, self, a_bzrdir, shared)
 
3187
        for hook in hooks:
 
3188
            hook(params)
 
3189
 
3174
3190
 
3175
3191
class MetaDirRepositoryFormat(RepositoryFormat):
3176
3192
    """Common base class for the new repositories using the metadir layout."""