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)
499
499
except errors.NoRepositoryPresent:
500
500
repository = None
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
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
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.",
1382
1377
# install the default hooks
1383
1378
BzrDir.hooks = BzrDirHooks()
1386
class RepoInitHookParams(object):
1387
"""Object holding parameters passed to *_repo_init hooks.
1389
There are 4 fields that hooks may wish to access:
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
1397
def __init__(self, repository, format, a_bzrdir, shared):
1398
"""Create a group of RepoInitHook parameters.
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
1405
self.repository = repository
1406
self.format = format
1407
self.bzrdir = a_bzrdir
1408
self.shared = shared
1410
def __eq__(self, other):
1411
return self.__dict__ == other.__dict__
1415
return "<%s for %s>" % (self.__class__.__name__,
1418
return "<%s for %s>" % (self.__class__.__name__,
1422
1381
class BzrDirPreSplitOut(BzrDir):
1423
1382
"""A common class for the all-in-one formats."""
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)
2740
2699
self.pb.finished()
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)
3121
3080
def make_lock(self, name):
3122
3081
"""Make a lock for the new control dir name."""
3704
3663
stack_on = urlutils.rebase_url(self._stack_on,
3705
3664
self._stack_on_pwd,
3665
branch.bzrdir.root_transport.base)
3707
3666
except errors.InvalidRebaseURLs:
3708
3667
stack_on = self._get_full_stack_on()