339
343
control = bzrdir.BzrDir.open(base)
340
344
return control.open_repository()
342
def copy_content_into(self, destination, revision_id=None, basis=None):
346
def copy_content_into(self, destination, revision_id=None):
343
347
"""Make a complete copy of the content in self into destination.
345
349
This is a destructive operation! Do not use it on existing
348
352
revision_id = osutils.safe_revision_id(revision_id)
349
return InterRepository.get(self, destination).copy_content(revision_id, basis)
353
return InterRepository.get(self, destination).copy_content(revision_id)
351
355
def fetch(self, source, revision_id=None, pb=None):
352
356
"""Fetch the content required to construct revision_id from source.
354
358
If revision_id is None all content is copied.
356
360
revision_id = osutils.safe_revision_id(revision_id)
357
return InterRepository.get(source, self).fetch(revision_id=revision_id,
361
inter = InterRepository.get(source, self)
363
return inter.fetch(revision_id=revision_id, pb=pb)
364
except NotImplementedError:
365
raise errors.IncompatibleRepositories(source, self)
360
367
def get_commit_builder(self, branch, parents, config, timestamp=None,
361
368
timezone=None, committer=None, revprops=None,
1392
1398
# TODO: jam 20070210 This is fairly internal, so we should probably
1393
1399
# just assert that revision_id is not unicode.
1394
1400
revision_id = osutils.safe_revision_id(revision_id)
1395
# grab the basis available data
1396
if basis is not None:
1397
self.target.fetch(basis, revision_id=revision_id)
1398
1401
# but don't bother fetching if we have the needed data now.
1399
1402
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1400
1403
self.target.has_revision(revision_id)):
1451
1454
@needs_write_lock
1452
def copy_content(self, revision_id=None, basis=None):
1455
def copy_content(self, revision_id=None):
1453
1456
"""See InterRepository.copy_content()."""
1454
1457
# weave specific optimised path:
1455
1458
# TODO: jam 20070210 Internal, should be an assert, not translate
1456
1459
revision_id = osutils.safe_revision_id(revision_id)
1457
if basis is not None:
1458
# copy the basis in, then fetch remaining data.
1459
basis.copy_content_into(self.target, revision_id)
1460
# the basis copy_content_into could miss-set this.
1461
self.target.set_make_working_trees(self.source.make_working_trees())
1462
except NotImplementedError:
1464
# FIXME do not peek!
1465
if self.source.control_files._transport.listable():
1466
pb = ui.ui_factory.nested_progress_bar()
1462
self.target.set_make_working_trees(self.source.make_working_trees())
1463
except NotImplementedError:
1468
self.target.weave_store.copy_all_ids(
1469
self.source.weave_store,
1471
from_transaction=self.source.get_transaction(),
1472
to_transaction=self.target.get_transaction())
1473
pb.update('copying inventory', 0, 1)
1474
self.target.control_weaves.copy_multi(
1475
self.source.control_weaves, ['inventory'],
1476
from_transaction=self.source.get_transaction(),
1477
to_transaction=self.target.get_transaction())
1478
self.target._revision_store.text_store.copy_all_ids(
1479
self.source._revision_store.text_store,
1465
1484
self.target.fetch(self.source, revision_id=revision_id)
1468
self.target.set_make_working_trees(self.source.make_working_trees())
1469
except NotImplementedError:
1471
# FIXME do not peek!
1472
if self.source.control_files._transport.listable():
1473
pb = ui.ui_factory.nested_progress_bar()
1475
self.target.weave_store.copy_all_ids(
1476
self.source.weave_store,
1478
from_transaction=self.source.get_transaction(),
1479
to_transaction=self.target.get_transaction())
1480
pb.update('copying inventory', 0, 1)
1481
self.target.control_weaves.copy_multi(
1482
self.source.control_weaves, ['inventory'],
1483
from_transaction=self.source.get_transaction(),
1484
to_transaction=self.target.get_transaction())
1485
self.target._revision_store.text_store.copy_all_ids(
1486
self.source._revision_store.text_store,
1491
self.target.fetch(self.source, revision_id=revision_id)
1493
1486
@needs_write_lock
1494
1487
def fetch(self, revision_id=None, pb=None):
1657
1649
# TODO: jam 20070210 Internal, assert, don't translate
1658
1650
revision_id = osutils.safe_revision_id(revision_id)
1659
# grab the basis available data
1660
if basis is not None:
1661
self.target.fetch(basis, revision_id=revision_id)
1662
1651
# but don't bother fetching if we have the needed data now.
1663
1652
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1664
1653
self.target.has_revision(revision_id)):