~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-17 01:36:21 UTC
  • mfrom: (4144.3.10 simplify-interrepo-stack)
  • Revision ID: pqm@pqm.ubuntu.com-20090317013621-d8sbugz1b1jrmzjk
(andrew) Remove InterRemoteToOther and InterOtherToRemote.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3299
3299
        return basis_id, basis_tree
3300
3300
 
3301
3301
 
3302
 
class InterOtherToRemote(InterRepository):
3303
 
    """An InterRepository that simply delegates to the 'real' InterRepository
3304
 
    calculated for (source, target._real_repository).
3305
 
    """
3306
 
 
3307
 
    def __init__(self, source, target):
3308
 
        InterRepository.__init__(self, source, target)
3309
 
        self._real_inter = None
3310
 
 
3311
 
    @staticmethod
3312
 
    def is_compatible(source, target):
3313
 
        if isinstance(target, remote.RemoteRepository):
3314
 
            return True
3315
 
        return False
3316
 
 
3317
 
    def _ensure_real_inter(self):
3318
 
        if self._real_inter is None:
3319
 
            self.target._ensure_real()
3320
 
            real_target = self.target._real_repository
3321
 
            self._real_inter = InterRepository.get(self.source, real_target)
3322
 
            # Make _real_inter use the RemoteRepository for get_parent_map
3323
 
            self._real_inter.target_get_graph = self.target.get_graph
3324
 
            self._real_inter.target_get_parent_map = self.target.get_parent_map
3325
 
 
3326
 
    def copy_content(self, revision_id=None):
3327
 
        self._ensure_real_inter()
3328
 
        self._real_inter.copy_content(revision_id=revision_id)
3329
 
 
3330
 
    def fetch(self, revision_id=None, pb=None, find_ghosts=False,
3331
 
            fetch_spec=None):
3332
 
        self._ensure_real_inter()
3333
 
        return self._real_inter.fetch(revision_id=revision_id, pb=pb,
3334
 
            find_ghosts=find_ghosts, fetch_spec=fetch_spec)
3335
 
 
3336
 
    @classmethod
3337
 
    def _get_repo_format_to_test(self):
3338
 
        return None
3339
 
 
3340
 
 
3341
 
class InterRemoteToOther(InterRepository):
3342
 
 
3343
 
    def __init__(self, source, target):
3344
 
        InterRepository.__init__(self, source, target)
3345
 
        self._real_inter = None
3346
 
 
3347
 
    @staticmethod
3348
 
    def is_compatible(source, target):
3349
 
        if not isinstance(source, remote.RemoteRepository):
3350
 
            return False
3351
 
        return InterRepository._same_model(source, target)
3352
 
 
3353
 
    def _ensure_real_inter(self):
3354
 
        if self._real_inter is None:
3355
 
            self.source._ensure_real()
3356
 
            real_source = self.source._real_repository
3357
 
            self._real_inter = InterRepository.get(real_source, self.target)
3358
 
 
3359
 
    def copy_content(self, revision_id=None):
3360
 
        self._ensure_real_inter()
3361
 
        self._real_inter.copy_content(revision_id=revision_id)
3362
 
 
3363
 
    @classmethod
3364
 
    def _get_repo_format_to_test(self):
3365
 
        return None
3366
 
 
3367
 
 
3368
 
 
3369
3302
class InterPackToRemotePack(InterPackRepo):
3370
3303
    """A specialisation of InterPackRepo for a target that is a
3371
3304
    RemoteRepository.
3418
3351
InterRepository.register_optimiser(InterWeaveRepo)
3419
3352
InterRepository.register_optimiser(InterKnitRepo)
3420
3353
InterRepository.register_optimiser(InterPackRepo)
3421
 
InterRepository.register_optimiser(InterOtherToRemote)
3422
 
InterRepository.register_optimiser(InterRemoteToOther)
3423
3354
InterRepository.register_optimiser(InterPackToRemotePack)
3424
3355
 
3425
3356