1484
1484
:param using: If True, list only branches using this repository.
1486
1486
if using and not self.is_shared():
1487
return self.bzrdir.list_branches()
1488
return [self.bzrdir.open_branch()]
1489
except errors.NotBranchError:
1488
1491
class Evaluator(object):
1490
1493
def __init__(self):
1499
1502
except errors.NoRepositoryPresent:
1502
return False, ([], repository)
1505
return False, (None, repository)
1503
1506
self.first_call = False
1504
value = (bzrdir.list_branches(), None)
1508
value = (bzrdir.open_branch(), None)
1509
except errors.NotBranchError:
1510
value = (None, None)
1505
1511
return True, value
1508
for branches, repository in bzrdir.BzrDir.find_bzrdirs(
1514
for branch, repository in bzrdir.BzrDir.find_bzrdirs(
1509
1515
self.bzrdir.root_transport, evaluate=Evaluator()):
1510
if branches is not None:
1511
ret.extend(branches)
1516
if branch is not None:
1517
branches.append(branch)
1512
1518
if not using and repository is not None:
1513
ret.extend(repository.find_branches())
1519
branches.extend(repository.find_branches())
1516
1522
@needs_read_lock
1517
1523
def search_missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
2160
2166
selected_keys = set((revid,) for revid in revision_ids)
2161
2167
w = _inv_weave or self.inventories
2162
return self._find_file_ids_from_xml_inventory_lines(
2163
w.iter_lines_added_or_present_in_keys(
2164
selected_keys, pb=None),
2168
pb = ui.ui_factory.nested_progress_bar()
2170
return self._find_file_ids_from_xml_inventory_lines(
2171
w.iter_lines_added_or_present_in_keys(
2172
selected_keys, pb=pb),
2167
2177
def iter_files_bytes(self, desired_files):
2168
2178
"""Iterate through file versions.
3408
3416
:param revision_id: if None all content is copied, if NULL_REVISION no
3409
3417
content is copied.
3418
:param pb: optional progress bar to use for progress reports. If not
3419
provided a default one will be created.
3413
ui.ui_factory.warn_experimental_format_fetch(self)
3414
3422
f = _mod_fetch.RepoFetcher(to_repository=self.target,
3415
3423
from_repository=self.source,
3416
3424
last_revision=revision_id,
3417
3425
fetch_spec=fetch_spec,
3418
find_ghosts=find_ghosts)
3426
pb=pb, find_ghosts=find_ghosts)
3420
3428
def _walk_to_common_revisions(self, revision_ids):
3421
3429
"""Walk out from revision_ids in source to revisions target has.
4002
4010
ui.ui_factory.warn_cross_format_fetch(self.source._format,
4003
4011
self.target._format)
4004
ui.ui_factory.warn_experimental_format_fetch(self)
4005
4012
if (not self.source.supports_rich_root()
4006
4013
and self.target.supports_rich_root()):
4007
4014
self._converting_to_rich_root = True
4082
4089
:param to_convert: The disk object to convert.
4083
4090
:param pb: a progress bar to use for progress information.
4085
pb = ui.ui_factory.nested_progress_bar()
4088
4095
# this is only useful with metadir layouts - separated repo content.
4089
4096
# trigger an assertion if not such
4090
4097
repo._format.get_format_string()
4091
4098
self.repo_dir = repo.bzrdir
4092
pb.update('Moving repository to repository.backup')
4099
self.step('Moving repository to repository.backup')
4093
4100
self.repo_dir.transport.move('repository', 'repository.backup')
4094
4101
backup_transport = self.repo_dir.transport.clone('repository.backup')
4095
4102
repo._format.check_conversion_target(self.target_format)
4096
4103
self.source_repo = repo._format.open(self.repo_dir,
4098
4105
_override_transport=backup_transport)
4099
pb.update('Creating new repository')
4106
self.step('Creating new repository')
4100
4107
converted = self.target_format.initialize(self.repo_dir,
4101
4108
self.source_repo.is_shared())
4102
4109
converted.lock_write()
4104
pb.update('Copying content')
4111
self.step('Copying content')
4105
4112
self.source_repo.copy_content_into(converted)
4107
4114
converted.unlock()
4108
pb.update('Deleting old repository content')
4115
self.step('Deleting old repository content')
4109
4116
self.repo_dir.transport.delete_tree('repository.backup')
4110
4117
ui.ui_factory.note('repository converted')
4119
def step(self, message):
4120
"""Update the pb by a step."""
4122
self.pb.update(message, self.count, self.total)
4114
4125
_unescape_map = {