/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: Jelmer Vernooij
  • Date: 2010-04-29 08:59:13 UTC
  • mfrom: (5193 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5218.
  • Revision ID: jelmer@samba.org-20100429085913-7208x0s3of34kehh
merge bzr.dev.

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:
2581
2588
            keys = tsort.topo_sort(parent_map)
2582
2589
        return [None] + list(keys)
2583
2590
 
2584
 
    def pack(self, hint=None):
 
2591
    def pack(self, hint=None, clean_obsolete_packs=False):
2585
2592
        """Compress the data within the repository.
2586
2593
 
2587
2594
        This operation only makes sense for some repository types. For other
2597
2604
            obtained from the result of commit_write_group(). Out of
2598
2605
            date hints are simply ignored, because concurrent operations
2599
2606
            can obsolete them rapidly.
 
2607
 
 
2608
        :param clean_obsolete_packs: Clean obsolete packs immediately after
 
2609
            the pack operation.
2600
2610
        """
2601
2611
 
2602
2612
    def get_transaction(self):
3168
3178
        """
3169
3179
        raise NotImplementedError(self.open)
3170
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
 
3171
3190
 
3172
3191
class MetaDirRepositoryFormat(RepositoryFormat):
3173
3192
    """Common base class for the new repositories using the metadir layout."""