/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/bzrdir.py

  • Committer: Martin Pool
  • Date: 2010-04-21 09:57:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421095718-u3c4w7k1crba29fq
Change info code to use user_url etc

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
                # copied, and finally if we are copying up to a specific
295
295
                # revision_id then we can use the pending-ancestry-result which
296
296
                # does not require traversing all of history to describe it.
297
 
                if (result_repo.user_url == result.user_url
298
 
                    and not require_stacking and
 
297
                if (result_repo.bzrdir.root_transport.base ==
 
298
                    result.root_transport.base and not require_stacking and
299
299
                    revision_id is not None):
300
300
                    fetch_spec = graph.PendingAncestryResult(
301
301
                        [revision_id], local_repo)
491
491
            stop = False
492
492
            stack_on = config.get_default_stack_on()
493
493
            if stack_on is not None:
494
 
                stack_on_pwd = found_bzrdir.user_url
 
494
                stack_on_pwd = found_bzrdir.root_transport.base
495
495
                stop = True
496
496
            # does it have a repository ?
497
497
            try:
499
499
            except errors.NoRepositoryPresent:
500
500
                repository = None
501
501
            else:
502
 
                if (found_bzrdir.user_url != self.user_url 
503
 
                    and not repository.is_shared()):
 
502
                if ((found_bzrdir.root_transport.base !=
 
503
                     self.root_transport.base) and not repository.is_shared()):
504
504
                    # Don't look higher, can't use a higher shared repo.
505
505
                    repository = None
506
506
                    stop = True
702
702
            if stop:
703
703
                return result
704
704
            next_transport = found_bzrdir.root_transport.clone('..')
705
 
            if (found_bzrdir.user_url == next_transport.base):
 
705
            if (found_bzrdir.root_transport.base == next_transport.base):
706
706
                # top of the file system
707
707
                return None
708
708
            # find the next containing bzrdir
725
725
                repository = found_bzrdir.open_repository()
726
726
            except errors.NoRepositoryPresent:
727
727
                return None, False
728
 
            if found_bzrdir.user_url == self.user_url:
 
728
            if found_bzrdir.root_transport.base == self.root_transport.base:
729
729
                return repository, True
730
730
            elif repository.is_shared():
731
731
                return repository, True
1373
1373
        self.create_hook(hooks.HookPoint('pre_open',
1374
1374
            "Invoked before attempting to open a BzrDir with the transport "
1375
1375
            "that the open will use.", (1, 14), None))
1376
 
        self.create_hook(hooks.HookPoint('post_repo_init',
1377
 
            "Invoked after a repository has been initialized. "
1378
 
            "post_repo_init is called with a "
1379
 
            "bzrlib.bzrdir.RepoInitHookParams.",
1380
 
            (2, 2), None))
1381
1376
 
1382
1377
# install the default hooks
1383
1378
BzrDir.hooks = BzrDirHooks()
1384
1379
 
1385
1380
 
1386
 
class RepoInitHookParams(object):
1387
 
    """Object holding parameters passed to *_repo_init hooks.
1388
 
 
1389
 
    There are 4 fields that hooks may wish to access:
1390
 
 
1391
 
    :ivar repository: Repository created
1392
 
    :ivar format: Repository format
1393
 
    :ivar bzrdir: The bzrdir for the repository
1394
 
    :ivar shared: The repository is shared
1395
 
    """
1396
 
 
1397
 
    def __init__(self, repository, format, a_bzrdir, shared):
1398
 
        """Create a group of RepoInitHook parameters.
1399
 
 
1400
 
        :param repository: Repository created
1401
 
        :param format: Repository format
1402
 
        :param bzrdir: The bzrdir for the repository
1403
 
        :param shared: The repository is shared
1404
 
        """
1405
 
        self.repository = repository
1406
 
        self.format = format
1407
 
        self.bzrdir = a_bzrdir
1408
 
        self.shared = shared
1409
 
 
1410
 
    def __eq__(self, other):
1411
 
        return self.__dict__ == other.__dict__
1412
 
 
1413
 
    def __repr__(self):
1414
 
        if self.repository:
1415
 
            return "<%s for %s>" % (self.__class__.__name__,
1416
 
                self.repository)
1417
 
        else:
1418
 
            return "<%s for %s>" % (self.__class__.__name__,
1419
 
                self.bzrdir)
1420
 
 
1421
 
 
1422
1381
class BzrDirPreSplitOut(BzrDir):
1423
1382
    """A common class for the all-in-one formats."""
1424
1383
 
2735
2694
            if isinstance(self.bzrdir.transport, local.LocalTransport):
2736
2695
                self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
2737
2696
            self._convert_to_weaves()
2738
 
            return BzrDir.open(self.bzrdir.user_url)
 
2697
            return BzrDir.open(self.bzrdir.root_transport.base)
2739
2698
        finally:
2740
2699
            self.pb.finished()
2741
2700
 
2988
2947
        try:
2989
2948
            ui.ui_factory.note('starting upgrade from format 5 to 6')
2990
2949
            self._convert_to_prefixed()
2991
 
            return BzrDir.open(self.bzrdir.user_url)
 
2950
            return BzrDir.open(self.bzrdir.root_transport.base)
2992
2951
        finally:
2993
2952
            pb.finished()
2994
2953
 
3116
3075
            BzrDirMetaFormat1().get_format_string(),
3117
3076
            mode=self.file_mode)
3118
3077
        self.pb.finished()
3119
 
        return BzrDir.open(self.bzrdir.user_url)
 
3078
        return BzrDir.open(self.bzrdir.root_transport.base)
3120
3079
 
3121
3080
    def make_lock(self, name):
3122
3081
        """Make a lock for the new control dir name."""
3703
3662
            try:
3704
3663
                stack_on = urlutils.rebase_url(self._stack_on,
3705
3664
                    self._stack_on_pwd,
3706
 
                    branch.user_url)
 
3665
                    branch.bzrdir.root_transport.base)
3707
3666
            except errors.InvalidRebaseURLs:
3708
3667
                stack_on = self._get_full_stack_on()
3709
3668
        try: