311
311
control = bzrdir.BzrDir.open(base)
312
312
return control.open_repository()
314
def copy_content_into(self, destination, revision_id=None, basis=None):
314
def copy_content_into(self, destination, revision_id=None):
315
315
"""Make a complete copy of the content in self into destination.
317
317
This is a destructive operation! Do not use it on existing
320
320
revision_id = osutils.safe_revision_id(revision_id)
321
return InterRepository.get(self, destination).copy_content(revision_id, basis)
321
return InterRepository.get(self, destination).copy_content(revision_id)
323
323
def fetch(self, source, revision_id=None, pb=None):
324
324
"""Fetch the content required to construct revision_id from source.
326
326
If revision_id is None all content is copied.
328
328
revision_id = osutils.safe_revision_id(revision_id)
329
return InterRepository.get(source, self).fetch(revision_id=revision_id,
329
inter = InterRepository.get(source, self)
331
return inter.fetch(revision_id=revision_id, pb=pb)
332
except NotImplementedError:
333
raise errors.IncompatibleRepositories(source, self)
332
335
def get_commit_builder(self, branch, parents, config, timestamp=None,
333
336
timezone=None, committer=None, revprops=None,
1366
1369
# TODO: jam 20070210 This is fairly internal, so we should probably
1367
1370
# just assert that revision_id is not unicode.
1368
1371
revision_id = osutils.safe_revision_id(revision_id)
1369
# grab the basis available data
1370
if basis is not None:
1371
self.target.fetch(basis, revision_id=revision_id)
1372
1372
# but don't bother fetching if we have the needed data now.
1373
1373
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1374
1374
self.target.has_revision(revision_id)):
1425
1425
@needs_write_lock
1426
def copy_content(self, revision_id=None, basis=None):
1426
def copy_content(self, revision_id=None):
1427
1427
"""See InterRepository.copy_content()."""
1428
1428
# weave specific optimised path:
1429
1429
# TODO: jam 20070210 Internal, should be an assert, not translate
1430
1430
revision_id = osutils.safe_revision_id(revision_id)
1431
if basis is not None:
1432
# copy the basis in, then fetch remaining data.
1433
basis.copy_content_into(self.target, revision_id)
1434
# the basis copy_content_into could miss-set this.
1432
self.target.set_make_working_trees(self.source.make_working_trees())
1433
except NotImplementedError:
1435
# FIXME do not peek!
1436
if self.source.control_files._transport.listable():
1437
pb = ui.ui_factory.nested_progress_bar()
1436
self.target.set_make_working_trees(self.source.make_working_trees())
1437
except NotImplementedError:
1439
self.target.weave_store.copy_all_ids(
1440
self.source.weave_store,
1442
from_transaction=self.source.get_transaction(),
1443
to_transaction=self.target.get_transaction())
1444
pb.update('copying inventory', 0, 1)
1445
self.target.control_weaves.copy_multi(
1446
self.source.control_weaves, ['inventory'],
1447
from_transaction=self.source.get_transaction(),
1448
to_transaction=self.target.get_transaction())
1449
self.target._revision_store.text_store.copy_all_ids(
1450
self.source._revision_store.text_store,
1439
1455
self.target.fetch(self.source, revision_id=revision_id)
1442
self.target.set_make_working_trees(self.source.make_working_trees())
1443
except NotImplementedError:
1445
# FIXME do not peek!
1446
if self.source.control_files._transport.listable():
1447
pb = ui.ui_factory.nested_progress_bar()
1449
self.target.weave_store.copy_all_ids(
1450
self.source.weave_store,
1452
from_transaction=self.source.get_transaction(),
1453
to_transaction=self.target.get_transaction())
1454
pb.update('copying inventory', 0, 1)
1455
self.target.control_weaves.copy_multi(
1456
self.source.control_weaves, ['inventory'],
1457
from_transaction=self.source.get_transaction(),
1458
to_transaction=self.target.get_transaction())
1459
self.target._revision_store.text_store.copy_all_ids(
1460
self.source._revision_store.text_store,
1465
self.target.fetch(self.source, revision_id=revision_id)
1467
1457
@needs_write_lock
1468
1458
def fetch(self, revision_id=None, pb=None):
1635
1624
# TODO: jam 20070210 Internal, assert, don't translate
1636
1625
revision_id = osutils.safe_revision_id(revision_id)
1637
# grab the basis available data
1638
if basis is not None:
1639
self.target.fetch(basis, revision_id=revision_id)
1640
1626
# but don't bother fetching if we have the needed data now.
1641
1627
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1642
1628
self.target.has_revision(revision_id)):