Rev 3584: (robertc) Give repository objects more control over the generic fetch in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jul 29 01:31:07 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3584
revision-id:pqm at pqm.ubuntu.com-20080729003054-v5qw7d5bbn1jtrj5
parent: pqm at pqm.ubuntu.com-20080728072348-iu8k0mg3zq36v1nd
parent: robertc at robertcollins.net-20080728091228-jyx4832utkwztez3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-07-29 01:30:54 +0100
message:
(robertc) Give repository objects more control over the generic fetch
process. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/_patiencediff_py.py cdvdifflib.py-20051106064558-f8f8097fbf0db4e4
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
------------------------------------------------------------
revno: 3565.3.4
revision-id:robertc at robertcollins.net-20080728091228-jyx4832utkwztez3
parent: robertc at robertcollins.net-20080728083915-7p1w6504b661e31g
committer: Robert Collins <robertc at robertcollins.net>
branch nick: btree-graphindex
timestamp: Mon 2008-07-28 19:12:28 +1000
message:
Defer decision to reconcile to the repository being fetched into.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
------------------------------------------------------------
revno: 3565.3.3
revision-id:robertc at robertcollins.net-20080728083915-7p1w6504b661e31g
parent: robertc at robertcollins.net-20080728060842-uayjy217i066dvct
committer: Robert Collins <robertc at robertcollins.net>
branch nick: btree-graphindex
timestamp: Mon 2008-07-28 18:39:15 +1000
message:
* Fetching data between repositories that have the same model but no
optimised fetcher will not reserialise all the revisions, increasing
performance. (Robert Collins, John Arbash Meinel)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
------------------------------------------------------------
revno: 3565.3.2
revision-id:robertc at robertcollins.net-20080728060842-uayjy217i066dvct
parent: robertc at robertcollins.net-20080728050954-iyok0yyqonml80q7
parent: pqm at pqm.ubuntu.com-20080725151945-kdaru30ix1m8k0h6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: btree-graphindex
timestamp: Mon 2008-07-28 16:08:42 +1000
message:
Merge .dev.
added:
doc/developers/ppa.txt ppa.txt-20080722055539-606u7t2z32t3ae4w-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/smart/protocol.py protocol.py-20061108035435-ot0lstk2590yqhzr-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_info.py test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_revision.py testrevision.py-20050804210559-46f5e1eb67b01289
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/test_urlutils.py test_urlutils.py-20060502192900-46b1f9579987cf9c
bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/urlutils.py urlutils.py-20060502195429-e8a161ecf8fac004
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/developers/releasing.txt releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
------------------------------------------------------------
revno: 3565.3.1
revision-id:robertc at robertcollins.net-20080728050954-iyok0yyqonml80q7
parent: pqm at pqm.ubuntu.com-20080718100017-segv2csk7ux2xs9p
committer: Robert Collins <robertc at robertcollins.net>
branch nick: btree-graphindex
timestamp: Mon 2008-07-28 15:09:54 +1000
message:
* The generic fetch code now uses two attributes on Repository objects
to control the requested streams: ``_fetch_order`` and
``_fetch_uses_deltas``. Setting these appropriately allows different
repository implementations to recieve data in their optimial form.
(Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/_patiencediff_py.py cdvdifflib.py-20051106064558-f8f8097fbf0db4e4
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'NEWS'
--- a/NEWS 2008-07-28 06:53:44 +0000
+++ b/NEWS 2008-07-29 00:30:54 +0000
@@ -31,6 +31,9 @@
Anywhere from 2x-6x faster depending on the size of the tree (bigger
trees, bigger benefit.) (John Arbash Meinel)
+ * Fetching data between repositories that have the same model but no
+ optimised fetcher will not reserialise all the revisions, increasing
+ performance. (Robert Collins, John Arbash Meinel)
BUG FIXES:
@@ -54,6 +57,13 @@
API CHANGES:
+ * The generic fetch code now uses three attributes on Repository objects
+ to control fetch. The streams requested are controlled via :
+ ``_fetch_order`` and ``_fetch_uses_deltas``. Setting these
+ appropriately allows different repository implementations to recieve
+ data in their optimial form. If the ``_fetch_reconcile`` is set then
+ a reconcile operation is triggered at the end of the fetch.
+ (Robert Collins)
INTERNALS:
=== modified file 'bzrlib/_patiencediff_py.py'
--- a/bzrlib/_patiencediff_py.py 2008-05-08 04:12:06 +0000
+++ b/bzrlib/_patiencediff_py.py 2008-07-28 05:09:54 +0000
@@ -176,7 +176,7 @@
length = 0
for i_a, i_b in matches:
if (start_a is not None
- and (i_a == start_a + length)
+ and (i_a == start_a + length)
and (i_b == start_b + length)):
length += 1
else:
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py 2008-06-25 10:06:48 +0000
+++ b/bzrlib/fetch.py 2008-07-28 09:12:28 +0000
@@ -179,7 +179,8 @@
to_texts = self.to_repository.texts
from_texts = self.from_repository.texts
to_texts.insert_record_stream(from_texts.get_record_stream(
- text_keys, 'topological', False))
+ text_keys, self.to_repository._fetch_order,
+ self.to_repository._fetch_uses_deltas))
# Cause an error if a text occurs after we have done the
# copy.
text_keys = None
@@ -198,6 +199,8 @@
self._fetch_revision_texts(revs, pb)
else:
raise AssertionError("Unknown knit kind %r" % knit_kind)
+ if self.to_repository._fetch_reconcile:
+ self.to_repository.reconcile()
finally:
if pb is not None:
pb.finished()
@@ -239,61 +242,11 @@
# corrupt.
to_weave.insert_record_stream(from_weave.get_record_stream(
[(rev_id,) for rev_id in revs],
- 'topological', False))
+ self.to_repository._fetch_order,
+ self.to_repository._fetch_uses_deltas))
finally:
child_pb.finished()
- def _generate_root_texts(self, revs):
- """This will be called by __fetch between fetching weave texts and
- fetching the inventory weave.
-
- Subclasses should override this if they need to generate root texts
- after fetching weave texts.
- """
- pass
-
-
-class GenericRepoFetcher(RepoFetcher):
- """This is a generic repo to repo fetcher.
-
- This makes minimal assumptions about repo layout and contents.
- It triggers a reconciliation after fetching to ensure integrity.
- """
-
- def _fetch_revision_texts(self, revs, pb):
- """Fetch revision object texts"""
- count = 0
- total = len(revs)
- for rev in revs:
- pb.update('copying revisions', count, total)
- try:
- sig_text = self.from_repository.get_signature_text(rev)
- self.to_repository.add_signature_text(rev, sig_text)
- except errors.NoSuchRevision:
- # not signed.
- pass
- self._copy_revision(rev)
- count += 1
- # fixup inventory if needed:
- # this is expensive because we have no inverse index to current ghosts.
- # but on local disk its a few seconds and sftp push is already insane.
- # so we just-do-it.
- # FIXME: repository should inform if this is needed.
- self.to_repository.reconcile()
-
- def _copy_revision(self, rev_id):
- rev = self.from_repository.get_revision(rev_id)
- self.to_repository.add_revision(rev_id, rev)
-
-
-class KnitRepoFetcher(RepoFetcher):
- """This is a knit format repository specific fetcher.
-
- This differs from the GenericRepoFetcher by not doing a
- reconciliation after copying, and using knit joining to
- copy revision texts.
- """
-
def _fetch_revision_texts(self, revs, pb):
# may need to be a InterRevisionStore call here.
to_sf = self.to_repository.signatures
@@ -301,7 +254,8 @@
# A missing signature is just skipped.
to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
[(rev_id,) for rev_id in revs],
- 'unordered', False)))
+ self.to_repository._fetch_order,
+ self.to_repository._fetch_uses_deltas)))
self._fetch_just_revision_texts(revs)
def _fetch_just_revision_texts(self, version_ids):
@@ -309,7 +263,17 @@
from_rf = self.from_repository.revisions
to_rf.insert_record_stream(from_rf.get_record_stream(
[(rev_id,) for rev_id in version_ids],
- 'topological', False))
+ self.to_repository._fetch_order,
+ self.to_repository._fetch_uses_deltas))
+
+ def _generate_root_texts(self, revs):
+ """This will be called by __fetch between fetching weave texts and
+ fetching the inventory weave.
+
+ Subclasses should override this if they need to generate root texts
+ after fetching weave texts.
+ """
+ pass
class Inter1and2Helper(object):
@@ -420,13 +384,13 @@
self.target.add_revision(revision.revision_id, revision)
-class Model1toKnit2Fetcher(GenericRepoFetcher):
+class Model1toKnit2Fetcher(RepoFetcher):
"""Fetch from a Model1 repository into a Knit2 repository
"""
def __init__(self, to_repository, from_repository, last_revision=None,
pb=None, find_ghosts=True):
self.helper = Inter1and2Helper(from_repository, to_repository)
- GenericRepoFetcher.__init__(self, to_repository, from_repository,
+ RepoFetcher.__init__(self, to_repository, from_repository,
last_revision, pb, find_ghosts)
def _generate_root_texts(self, revs):
@@ -435,17 +399,32 @@
def _fetch_inventory_weave(self, revs, pb):
self.helper.regenerate_inventory(revs)
+ def _fetch_revision_texts(self, revs, pb):
+ """Fetch revision object texts"""
+ count = 0
+ total = len(revs)
+ for rev in revs:
+ pb.update('copying revisions', count, total)
+ try:
+ sig_text = self.from_repository.get_signature_text(rev)
+ self.to_repository.add_signature_text(rev, sig_text)
+ except errors.NoSuchRevision:
+ # not signed.
+ pass
+ self._copy_revision(rev)
+ count += 1
+
def _copy_revision(self, rev):
self.helper.fetch_revisions([rev])
-class Knit1to2Fetcher(KnitRepoFetcher):
+class Knit1to2Fetcher(RepoFetcher):
"""Fetch from a Knit1 repository into a Knit2 repository"""
- def __init__(self, to_repository, from_repository, last_revision=None,
+ def __init__(self, to_repository, from_repository, last_revision=None,
pb=None, find_ghosts=True):
self.helper = Inter1and2Helper(from_repository, to_repository)
- KnitRepoFetcher.__init__(self, to_repository, from_repository,
+ RepoFetcher.__init__(self, to_repository, from_repository,
last_revision, pb, find_ghosts)
def _generate_root_texts(self, revs):
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-07-25 06:42:08 +0000
+++ b/bzrlib/remote.py 2008-07-28 09:12:28 +0000
@@ -816,6 +816,36 @@
self._ensure_real()
return self._real_repository.iter_files_bytes(desired_files)
+ @property
+ def _fetch_order(self):
+ """Decorate the real repository for now.
+
+ In the long term getting this back from the remote repository as part
+ of open would be more efficient.
+ """
+ self._ensure_real()
+ return self._real_repository._fetch_order
+
+ @property
+ def _fetch_uses_deltas(self):
+ """Decorate the real repository for now.
+
+ In the long term getting this back from the remote repository as part
+ of open would be more efficient.
+ """
+ self._ensure_real()
+ return self._real_repository._fetch_uses_deltas
+
+ @property
+ def _fetch_reconcile(self):
+ """Decorate the real repository for now.
+
+ In the long term getting this back from the remote repository as part
+ of open would be more efficient.
+ """
+ self._ensure_real()
+ return self._real_repository._fetch_reconcile
+
def get_parent_map(self, keys):
"""See bzrlib.Graph.get_parent_map()."""
# Hack to build up the caching logic.
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py 2008-07-24 08:28:05 +0000
+++ b/bzrlib/repofmt/knitrepo.py 2008-07-28 06:08:42 +0000
@@ -130,6 +130,8 @@
self._commit_builder_class = _commit_builder_class
self._serializer = _serializer
self._reconcile_fixes_text_parents = True
+ self._fetch_uses_deltas = True
+ self._fetch_order = 'topological'
@needs_read_lock
def _all_revision_ids(self):
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2008-07-24 08:28:05 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2008-07-28 06:08:42 +0000
@@ -1728,6 +1728,7 @@
self._reconcile_does_inventory_gc = True
self._reconcile_fixes_text_parents = True
self._reconcile_backsup_inventory = False
+ self._fetch_order = 'unsorted'
def _warn_if_deprecated(self):
# This class isn't deprecated
=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py 2008-06-18 07:56:09 +0000
+++ b/bzrlib/repofmt/weaverepo.py 2008-07-28 09:12:28 +0000
@@ -85,6 +85,8 @@
self.inventory_store = get_store('inventory-store')
self._text_store = get_store('text-store')
super(AllInOneRepository, self).__init__(_format, a_bzrdir, a_bzrdir._control_files)
+ self._fetch_order = 'topological'
+ self._fetch_reconcile = True
@needs_read_lock
def _all_possible_ids(self):
@@ -178,6 +180,11 @@
_serializer = xml5.serializer_v5
+ def __init__(self, _format, a_bzrdir, control_files):
+ super(WeaveMetaDirRepository, self).__init__(_format, a_bzrdir, control_files)
+ self._fetch_order = 'topological'
+ self._fetch_reconcile = True
+
@needs_read_lock
def _all_possible_ids(self):
"""Return all the possible revisions that we could find."""
@@ -317,6 +324,8 @@
def __init__(self):
super(RepositoryFormat4, self).__init__()
+ self._fetch_order = 'topological'
+ self._fetch_reconcile = True
def get_format_description(self):
"""See RepositoryFormat.get_format_description()."""
@@ -368,6 +377,8 @@
def __init__(self):
super(RepositoryFormat5, self).__init__()
+ self._fetch_order = 'topological'
+ self._fetch_reconcile = True
def get_format_description(self):
"""See RepositoryFormat.get_format_description()."""
@@ -410,6 +421,8 @@
def __init__(self):
super(RepositoryFormat6, self).__init__()
+ self._fetch_order = 'topological'
+ self._fetch_reconcile = True
def get_format_description(self):
"""See RepositoryFormat.get_format_description()."""
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-07-22 09:54:03 +0000
+++ b/bzrlib/repository.py 2008-07-28 09:12:28 +0000
@@ -690,6 +690,18 @@
self._write_group = None
# Additional places to query for data.
self._fallback_repositories = []
+ # What order should fetch operations request streams in?
+ # The default is unsorted as that is the cheapest for an origin to
+ # provide.
+ self._fetch_order = 'unsorted'
+ # Does this repository use deltas that can be fetched as-deltas ?
+ # (E.g. knits, where the knit deltas can be transplanted intact.
+ # We default to False, which will ensure that enough data to get
+ # a full text out of any fetch stream will be grabbed.
+ self._fetch_uses_deltas = False
+ # Should fetch trigger a reconcile after the fetch? Only needed for
+ # some repository formats that can suffer internal inconsistencies.
+ self._fetch_reconcile = False
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__,
@@ -2487,11 +2499,11 @@
@needs_write_lock
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
"""See InterRepository.fetch()."""
- from bzrlib.fetch import GenericRepoFetcher
+ from bzrlib.fetch import RepoFetcher
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
self.source, self.source._format, self.target,
self.target._format)
- f = GenericRepoFetcher(to_repository=self.target,
+ f = RepoFetcher(to_repository=self.target,
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
@@ -2568,10 +2580,10 @@
@needs_write_lock
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
"""See InterRepository.fetch()."""
- from bzrlib.fetch import GenericRepoFetcher
+ from bzrlib.fetch import RepoFetcher
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
self.source, self.source._format, self.target, self.target._format)
- f = GenericRepoFetcher(to_repository=self.target,
+ f = RepoFetcher(to_repository=self.target,
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
@@ -2649,10 +2661,10 @@
@needs_write_lock
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
"""See InterRepository.fetch()."""
- from bzrlib.fetch import KnitRepoFetcher
+ from bzrlib.fetch import RepoFetcher
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
self.source, self.source._format, self.target, self.target._format)
- f = KnitRepoFetcher(to_repository=self.target,
+ f = RepoFetcher(to_repository=self.target,
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
@@ -2720,8 +2732,8 @@
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
"""See InterRepository.fetch()."""
if len(self.source._fallback_repositories) > 0:
- from bzrlib.fetch import KnitRepoFetcher
- fetcher = KnitRepoFetcher(self.target, self.source, revision_id,
+ from bzrlib.fetch import RepoFetcher
+ fetcher = RepoFetcher(self.target, self.source, revision_id,
pb, find_ghosts)
return fetcher.count_copied, fetcher.failed_revisions
from bzrlib.repofmt.pack_repo import Packer
=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py 2008-07-15 05:06:13 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py 2008-07-28 09:12:28 +0000
@@ -64,6 +64,24 @@
class TestRepository(TestCaseWithRepository):
+ def test_attribute__fetch_order(self):
+ """Test the the _fetch_order attribute."""
+ tree = self.make_branch_and_tree('tree')
+ repo = tree.branch.repository
+ self.assertTrue(repo._fetch_order in ('topological', 'unsorted'))
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Test the the _fetch_uses_deltas attribute."""
+ tree = self.make_branch_and_tree('tree')
+ repo = tree.branch.repository
+ self.assertTrue(repo._fetch_uses_deltas in (True, False))
+
+ def test_attribute__fetch_reconcile(self):
+ """Test the the _fetch_reconcile attribute."""
+ tree = self.make_branch_and_tree('tree')
+ repo = tree.branch.repository
+ self.assertTrue(repo._fetch_reconcile in (True, False))
+
def test_attribute_inventories_store(self):
"""Test the existence of the inventories attribute."""
tree = self.make_branch_and_tree('tree')
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2008-07-14 06:39:43 +0000
+++ b/bzrlib/tests/test_repository.py 2008-07-28 09:12:28 +0000
@@ -162,6 +162,24 @@
class TestFormat6(TestCaseWithTransport):
+ def test_attribute__fetch_order(self):
+ """Weaves need topological data insertion."""
+ control = bzrdir.BzrDirFormat6().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat6().initialize(control)
+ self.assertEqual('topological', repo._fetch_order)
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Weaves do not reuse deltas."""
+ control = bzrdir.BzrDirFormat6().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat6().initialize(control)
+ self.assertEqual(False, repo._fetch_uses_deltas)
+
+ def test_attribute__fetch_reconcile(self):
+ """Weave repositories need a reconcile after fetch."""
+ control = bzrdir.BzrDirFormat6().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat6().initialize(control)
+ self.assertEqual(True, repo._fetch_reconcile)
+
def test_no_ancestry_weave(self):
control = bzrdir.BzrDirFormat6().initialize(self.get_url())
repo = weaverepo.RepositoryFormat6().initialize(control)
@@ -178,7 +196,25 @@
class TestFormat7(TestCaseWithTransport):
-
+
+ def test_attribute__fetch_order(self):
+ """Weaves need topological data insertion."""
+ control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat7().initialize(control)
+ self.assertEqual('topological', repo._fetch_order)
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Weaves do not reuse deltas."""
+ control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat7().initialize(control)
+ self.assertEqual(False, repo._fetch_uses_deltas)
+
+ def test_attribute__fetch_reconcile(self):
+ """Weave repositories need a reconcile after fetch."""
+ control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
+ repo = weaverepo.RepositoryFormat7().initialize(control)
+ self.assertEqual(True, repo._fetch_reconcile)
+
def test_disk_layout(self):
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
repo = weaverepo.RepositoryFormat7().initialize(control)
@@ -307,6 +343,18 @@
class TestFormatKnit1(TestCaseWithTransport):
+ def test_attribute__fetch_order(self):
+ """Knits need topological data insertion."""
+ repo = self.make_repository('.',
+ format=bzrdir.format_registry.get('knit')())
+ self.assertEqual('topological', repo._fetch_order)
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Knits reuse deltas."""
+ repo = self.make_repository('.',
+ format=bzrdir.format_registry.get('knit')())
+ self.assertEqual(True, repo._fetch_uses_deltas)
+
def test_disk_layout(self):
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
repo = knitrepo.RepositoryFormatKnit1().initialize(control)
@@ -558,6 +606,20 @@
class TestRepositoryFormatKnit3(TestCaseWithTransport):
+ def test_attribute__fetch_order(self):
+ """Knits need topological data insertion."""
+ format = bzrdir.BzrDirMetaFormat1()
+ format.repository_format = knitrepo.RepositoryFormatKnit3()
+ repo = self.make_repository('.', format=format)
+ self.assertEqual('topological', repo._fetch_order)
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Knits reuse deltas."""
+ format = bzrdir.BzrDirMetaFormat1()
+ format.repository_format = knitrepo.RepositoryFormatKnit3()
+ repo = self.make_repository('.', format=format)
+ self.assertEqual(True, repo._fetch_uses_deltas)
+
def test_convert(self):
"""Ensure the upgrade adds weaves for roots"""
format = bzrdir.BzrDirMetaFormat1()
@@ -682,6 +744,18 @@
def get_format(self):
return bzrdir.format_registry.make_bzrdir('pack-0.92')
+ def test_attribute__fetch_order(self):
+ """Packs do not need ordered data retrieval."""
+ format = self.get_format()
+ repo = self.make_repository('.', format=format)
+ self.assertEqual('unsorted', repo._fetch_order)
+
+ def test_attribute__fetch_uses_deltas(self):
+ """Packs reuse deltas."""
+ format = self.get_format()
+ repo = self.make_repository('.', format=format)
+ self.assertEqual(True, repo._fetch_uses_deltas)
+
def test_disk_layout(self):
format = self.get_format()
repo = self.make_repository('.', format=format)
More information about the bazaar-commits
mailing list