Rev 4647: Merge bzr.dev 4624 in preparation for NEWS in http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 18 15:50:05 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted
------------------------------------------------------------
revno: 4647 [merge]
revision-id: john at arbash-meinel.com-20090818144952-mk2cy45ax9twl3lm
parent: john at arbash-meinel.com-20090818144917-skyo0h1ntajmf76d
parent: pqm at pqm.ubuntu.com-20090818082317-8g5738hvi41aqhsh
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-known-graph-sorted
timestamp: Tue 2009-08-18 09:49:52 -0500
message:
Merge bzr.dev 4624 in preparation for NEWS
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-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/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_locale.py test_lang.py-20060824204205-80v50j25qkuop7yn-1
bzrlib/tests/per_branch/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/per_branch/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/per_bzrdir/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/per_repository/test_write_group.py test_write_group.py-20070716105516-89n34xtogq5frn0m-1
bzrlib/tests/per_workingtree/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-08-15 09:15:03 +0000
+++ b/NEWS 2009-08-18 07:20:02 +0000
@@ -9,6 +9,12 @@
In Development
##############
+Bug Fixes
+*********
+
+* Fix a test failure on karmic by making a locale test more robust.
+ (Vincent Ladeuil, #413514)
+
Improvements
************
@@ -58,6 +64,11 @@
* StreamSource generates rich roots from non-rich root sources correctly
now. (Andrew Bennetts, #368921)
+* When deciding whether a repository was compatible for upgrading or
+ fetching, we previously incorrectly checked the default repository
+ format for the bzrdir format, rather than the format that was actually
+ present on disk. (Martin Pool, #408824)
+
Improvements
************
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2009-08-17 20:41:26 +0000
+++ b/bzrlib/branch.py 2009-08-18 14:49:52 +0000
@@ -1152,6 +1152,9 @@
revision_id: if not None, the revision history in the new branch will
be truncated to end with revision_id.
"""
+ if (repository_policy is not None and
+ repository_policy.requires_stacking()):
+ to_bzrdir._format.require_stacking(_skip_repo=True)
result = to_bzrdir.create_branch()
result.lock_write()
try:
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2009-08-14 09:31:37 +0000
+++ b/bzrlib/bzrdir.py 2009-08-18 01:38:56 +0000
@@ -130,8 +130,7 @@
def check_conversion_target(self, target_format):
target_repo_format = target_format.repository_format
- source_repo_format = self._format.repository_format
- source_repo_format.check_conversion_target(target_repo_format)
+ self.open_repository()._format.check_conversion_target(target_repo_format)
@staticmethod
def _check_supported(format, allow_unsupported,
@@ -3549,6 +3548,10 @@
if self._require_stacking:
raise
+ def requires_stacking(self):
+ """Return True if this policy requires stacking."""
+ return self._stack_on is not None and self._require_stacking
+
def _get_full_stack_on(self):
"""Get a fully-qualified URL for the stack_on location."""
if self._stack_on is None:
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2009-08-14 09:31:37 +0000
+++ b/bzrlib/remote.py 2009-08-14 11:11:29 +0000
@@ -566,17 +566,6 @@
def __eq__(self, other):
return self.__class__ is other.__class__
- def check_conversion_target(self, target_format):
- if self.rich_root_data and not target_format.rich_root_data:
- raise errors.BadConversionTarget(
- 'Does not support rich root data.', target_format,
- from_format=self)
- if (self.supports_tree_reference and
- not getattr(target_format, 'supports_tree_reference', False)):
- raise errors.BadConversionTarget(
- 'Does not support nested trees', target_format,
- from_format=self)
-
def network_name(self):
if self._network_name:
return self._network_name
=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py 2009-08-14 09:37:57 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py 2009-08-18 02:19:38 +0000
@@ -810,9 +810,15 @@
yield inventory.CHKInventory.deserialise(self.chk_bytes, texts[key], key)
def _iter_inventory_xmls(self, revision_ids, ordering):
- # Without a native 'xml' inventory, this method doesn't make sense, so
- # make it raise to trap naughty direct users.
- raise NotImplementedError(self._iter_inventory_xmls)
+ # Without a native 'xml' inventory, this method doesn't make sense.
+ # However older working trees, and older bundles want it - so we supply
+ # it allowing get_inventory_xml to work. Bundles currently use the
+ # serializer directly; this also isn't ideal, but there isn't an xml
+ # iteration interface offered at all for repositories. We could make
+ # _iter_inventory_xmls be part of the contract, even if kept private.
+ inv_to_str = self._serializer.write_inventory_to_string
+ for inv in self.iter_inventories(revision_ids, ordering=ordering):
+ yield inv_to_str(inv), inv.revision_id
def _find_present_inventory_keys(self, revision_keys):
parent_map = self.inventories.get_parent_map(revision_keys)
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py 2009-08-14 09:37:57 +0000
+++ b/bzrlib/repofmt/knitrepo.py 2009-08-14 11:11:29 +0000
@@ -424,9 +424,6 @@
"""See RepositoryFormat.get_format_description()."""
return "Knit repository format 1"
- def check_conversion_target(self, target_format):
- pass
-
class RepositoryFormatKnit3(RepositoryFormatKnit):
"""Bzr repository knit format 3.
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2009-08-14 09:37:57 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2009-08-14 11:11:29 +0000
@@ -2529,9 +2529,6 @@
"""See RepositoryFormat.get_format_description()."""
return "Packs containing knits without subtree support"
- def check_conversion_target(self, target_format):
- pass
-
class RepositoryFormatKnitPack3(RepositoryFormatPack):
"""A subtrees parameterized Pack repository.
@@ -2647,9 +2644,6 @@
"""See RepositoryFormat.get_format_description()."""
return "Packs 5 (adds stacking support, requires bzr 1.6)"
- def check_conversion_target(self, target_format):
- pass
-
class RepositoryFormatKnitPack5RichRoot(RepositoryFormatPack):
"""A repository with rich roots and stacking.
@@ -2771,9 +2765,6 @@
"""See RepositoryFormat.get_format_description()."""
return "Packs 6 (uses btree indexes, requires bzr 1.9)"
- def check_conversion_target(self, target_format):
- pass
-
class RepositoryFormatKnitPack6RichRoot(RepositoryFormatPack):
"""A repository with rich roots, no subtrees, stacking and btree indexes.
=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py 2009-08-17 20:41:26 +0000
+++ b/bzrlib/repofmt/weaverepo.py 2009-08-18 14:49:52 +0000
@@ -320,9 +320,6 @@
result.chk_bytes = None
return result
- def check_conversion_target(self, target_format):
- pass
-
class RepositoryFormat4(PreSplitOutRepositoryFormat):
"""Bzr repository format 4.
@@ -495,9 +492,6 @@
"""See RepositoryFormat.get_format_description()."""
return "Weave repository format 7"
- def check_conversion_target(self, target_format):
- pass
-
def _get_inventories(self, repo_transport, repo, name='inventory'):
mapper = versionedfile.ConstantMapper(name)
return versionedfile.ThunkedVersionedFiles(repo_transport,
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-08-16 03:34:59 +0000
+++ b/bzrlib/repository.py 2009-08-18 14:49:52 +0000
@@ -3057,6 +3057,8 @@
# help), and for fetching when data won't have come from the same
# compressor.
pack_compresses = False
+ # Does the repository inventory storage understand references to trees?
+ supports_tree_reference = None
def __str__(self):
return "<%s>" % self.__class__.__name__
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-08-17 21:01:05 +0000
+++ b/bzrlib/tests/__init__.py 2009-08-18 14:49:52 +0000
@@ -2798,8 +2798,11 @@
decorators.append(filter_tests(pattern))
if suite_decorators:
decorators.extend(suite_decorators)
- # tell the result object how many tests will be running:
- decorators.append(CountingDecorator)
+ # tell the result object how many tests will be running: (except if
+ # --parallel=fork is being used. Robert said he will provide a better
+ # progress design later -- vila 20090817)
+ if fork_decorator not in decorators:
+ decorators.append(CountingDecorator)
for decorator in decorators:
suite = decorator(suite)
result = runner.run(suite)
=== modified file 'bzrlib/tests/blackbox/test_locale.py'
--- a/bzrlib/tests/blackbox/test_locale.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_locale.py 2009-08-17 22:16:49 +0000
@@ -61,21 +61,7 @@
'--no-aliases --no-plugins log -q --log-format=long tree',
env_changes={'LANG':'BOGUS', 'BZR_PROGRESS_BAR':'none',
'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
- # XXX: This depends on the exact formatting of a locale.Error
- # as the first part of the string. It may be a little tempermental
- self.assertEqualDiff("""\
-bzr: warning: unsupported locale setting
- bzr could not set the application locale.
- Although this should be no problem for bzr itself,
- it might cause problems with some plugins.
- To investigate the issue, look at the output
- of the locale(1p) tool available on POSIX systems.
-bzr: warning: unsupported locale setting
- Could not determine what text encoding to use.
- This error usually means your Python interpreter
- doesn't support the locale set by $LANG (BOGUS)
- Continuing with ascii encoding.
-""", err)
+ self.assertStartsWith(err, 'bzr: warning: unsupported locale setting')
self.assertEqualDiff("""\
------------------------------------------------------------
revno: 1
=== modified file 'bzrlib/tests/per_branch/__init__.py'
--- a/bzrlib/tests/per_branch/__init__.py 2009-07-10 10:46:00 +0000
+++ b/bzrlib/tests/per_branch/__init__.py 2009-08-17 06:17:21 +0000
@@ -78,7 +78,9 @@
return self.branch
def make_branch(self, relpath, format=None):
- repo = self.make_repository(relpath, format=format)
+ if format is not None:
+ return TestCaseWithBzrDir.make_branch(self, relpath, format)
+ repo = self.make_repository(relpath)
# fixme RBC 20060210 this isnt necessarily a fixable thing,
# Skipped is the wrong exception to raise.
try:
=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py 2009-08-14 13:55:30 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py 2009-08-17 06:17:21 +0000
@@ -278,14 +278,28 @@
self.assertRaises((errors.NotStacked, errors.UnstackableBranchFormat),
cloned_bzrdir.open_branch().get_stacked_on_url)
+ def make_stacked_on_matching(self, source):
+ if source.repository.supports_rich_root():
+ if source.repository._format.supports_chks:
+ format = "2a"
+ else:
+ format = "1.9-rich-root"
+ else:
+ format = "1.9"
+ return self.make_branch('stack-on', format)
+
def test_sprout_stacking_policy_handling(self):
"""Obey policy where possible, ignore otherwise."""
- stack_on = self.make_branch('stack-on')
+ if isinstance(self.branch_format, branch.BzrBranchFormat4):
+ raise TestNotApplicable('Branch format 4 does not autoupgrade.')
+ source = self.make_branch('source')
+ stack_on = self.make_stacked_on_matching(source)
parent_bzrdir = self.make_bzrdir('.', format='default')
parent_bzrdir.get_config().set_default_stack_on('stack-on')
- source = self.make_branch('source')
target = source.bzrdir.sprout('target').open_branch()
- if self.branch_format.supports_stacking():
+ # When we sprout we upgrade the branch when there is a default stack_on
+ # set by a config *and* the targeted branch supports stacking.
+ if stack_on._format.supports_stacking():
self.assertEqual('../stack-on', target.get_stacked_on_url())
else:
self.assertRaises(
@@ -293,13 +307,17 @@
def test_clone_stacking_policy_handling(self):
"""Obey policy where possible, ignore otherwise."""
+ if isinstance(self.branch_format, branch.BzrBranchFormat4):
+ raise TestNotApplicable('Branch format 4 does not autoupgrade.')
self.thisFailsStrictLockCheck()
- stack_on = self.make_branch('stack-on')
+ source = self.make_branch('source')
+ stack_on = self.make_stacked_on_matching(source)
parent_bzrdir = self.make_bzrdir('.', format='default')
parent_bzrdir.get_config().set_default_stack_on('stack-on')
- source = self.make_branch('source')
target = source.bzrdir.clone('target').open_branch()
- if self.branch_format.supports_stacking():
+ # When we clone we upgrade the branch when there is a default stack_on
+ # set by a config *and* the targeted branch supports stacking.
+ if stack_on._format.supports_stacking():
self.assertEqual('../stack-on', target.get_stacked_on_url())
else:
self.assertRaises(
@@ -309,13 +327,15 @@
"""Obey policy where possible, ignore otherwise."""
if isinstance(self.branch_format, branch.BzrBranchFormat4):
raise TestNotApplicable('Branch format 4 is not usable via HPSS.')
- stack_on = self.make_branch('stack-on')
+ source = self.make_branch('source')
+ stack_on = self.make_stacked_on_matching(source)
parent_bzrdir = self.make_bzrdir('.', format='default')
parent_bzrdir.get_config().set_default_stack_on('stack-on')
- source = self.make_branch('source')
url = self.make_smart_server('target').base
target = source.bzrdir.sprout(url).open_branch()
- if self.branch_format.supports_stacking():
+ # When we sprout we upgrade the branch when there is a default stack_on
+ # set by a config *and* the targeted branch supports stacking.
+ if stack_on._format.supports_stacking():
self.assertEqual('../stack-on', target.get_stacked_on_url())
else:
self.assertRaises(
@@ -352,10 +372,10 @@
# repository boundaries. however, i didn't actually get this test to
# fail on that code. -- mbp
# see https://bugs.launchpad.net/bzr/+bug/252821
- if not self.branch_format.supports_stacking():
+ stack_on = self.make_branch_and_tree('stack-on')
+ if not stack_on.branch._format.supports_stacking():
raise TestNotApplicable("%r does not support stacking"
% self.branch_format)
- stack_on = self.make_branch_and_tree('stack-on')
text_lines = ['line %d blah blah blah\n' % i for i in range(20)]
self.build_tree_contents([('stack-on/a', ''.join(text_lines))])
stack_on.add('a')
=== modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py'
--- a/bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-08-14 13:55:30 +0000
+++ b/bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-08-17 07:46:03 +0000
@@ -1258,7 +1258,7 @@
# repository is the same as the external location of the stacked-on
# branch.
balloon = self.make_bzrdir('balloon')
- if isinstance(balloon, bzrdir.BzrDirMetaFormat1):
+ if isinstance(balloon._format, bzrdir.BzrDirMetaFormat1):
stack_on = self.make_branch('stack-on', format='1.9')
else:
stack_on = self.make_branch('stack-on')
=== modified file 'bzrlib/tests/per_repository/test_write_group.py'
--- a/bzrlib/tests/per_repository/test_write_group.py 2009-06-26 09:24:34 +0000
+++ b/bzrlib/tests/per_repository/test_write_group.py 2009-08-17 04:18:57 +0000
@@ -131,6 +131,7 @@
# suppressed. See also test_pack_repository's test of the same name.
self.assertEqual(None, repo.abort_write_group(suppress_errors=True))
+
class TestGetMissingParentInventories(TestCaseWithRepository):
def test_empty_get_missing_parent_inventories(self):
@@ -332,8 +333,10 @@
def test_insert_stream_passes_resume_info(self):
repo = self.make_repository('test-repo')
- if not repo._format.supports_external_lookups:
- raise TestNotApplicable('only valid in resumable repos')
+ if (not repo._format.supports_external_lookups or
+ isinstance(repo, remote.RemoteRepository)):
+ raise TestNotApplicable(
+ 'only valid for direct connections to resumable repos')
# log calls to get_missing_parent_inventories, so that we can assert it
# is called with the correct parameters
call_log = []
=== modified file 'bzrlib/tests/per_workingtree/test_basis_inventory.py'
--- a/bzrlib/tests/per_workingtree/test_basis_inventory.py 2009-07-10 07:14:02 +0000
+++ b/bzrlib/tests/per_workingtree/test_basis_inventory.py 2009-08-17 06:58:22 +0000
@@ -49,7 +49,7 @@
self.assertEquals('r1', basis_inv.revision_id)
store_inv = b.repository.get_inventory('r1')
- self.assertEquals(store_inv._byid, basis_inv._byid)
+ self.assertEqual([], store_inv._make_delta(basis_inv))
open('b', 'wb').write('b\n')
t.add('b')
@@ -62,7 +62,7 @@
self.assertEquals('r2', basis_inv.revision_id)
store_inv = b.repository.get_inventory('r2')
- self.assertEquals(store_inv._byid, basis_inv._byid)
+ self.assertEqual([], store_inv._make_delta(basis_inv))
def test_wrong_format(self):
"""WorkingTree.basis safely ignores junk basis inventories"""
=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/tests/test_commit.py 2009-08-17 03:58:18 +0000
@@ -708,9 +708,10 @@
cb = self.Callback(u'commit 2', self)
repository = tree.branch.repository
# simulate network failure
- def raise_(self, arg, arg2):
+ def raise_(self, arg, arg2, arg3=None, arg4=None):
raise errors.NoSuchFile('foo')
repository.add_inventory = raise_
+ repository.add_inventory_by_delta = raise_
self.assertRaises(errors.NoSuchFile, tree.commit, message_callback=cb)
self.assertFalse(cb.called)
=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/tests/test_foreign.py 2009-08-14 04:30:32 +0000
@@ -309,6 +309,7 @@
self.build_tree_contents([('br1/bla', 'original contents\n')])
wt.add('bla', 'bla-a')
wt.commit('bla-a')
+ root_id = wt.get_root_id()
target = wt.bzrdir.sprout('br2').open_workingtree()
target.unversion(['bla-a'])
target.add('bla', 'bla-b')
@@ -319,7 +320,7 @@
foreign.update_workingtree_fileids(wt, target_basis)
wt.lock_read()
try:
- self.assertEquals(["TREE_ROOT", "bla-b"], list(wt.inventory))
+ self.assertEquals([root_id, "bla-b"], list(wt.inventory))
finally:
wt.unlock()
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py 2009-07-28 08:09:13 +0000
+++ b/bzrlib/tests/test_knit.py 2009-08-17 06:51:15 +0000
@@ -366,7 +366,7 @@
:return: (versioned_file, reload_counter)
versioned_file a KnitVersionedFiles using the packs for access
"""
- builder = self.make_branch_builder('.')
+ builder = self.make_branch_builder('.', format="1.9")
builder.start_series()
builder.build_snapshot('rev-1', None, [
('add', ('', 'root-id', 'directory', None)),
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2009-05-08 13:39:32 +0000
+++ b/bzrlib/tests/test_log.py 2009-08-17 19:31:29 +0000
@@ -1197,28 +1197,35 @@
# 4a: 3.1.1
return mainline_revs, rev_nos, wt
- def make_tree_with_many_merges(self):
+ def make_branch_with_many_merges(self):
"""Create a tree with well-known revision ids"""
- wt = self.make_branch_and_tree('tree1')
- self.build_tree_contents([('tree1/f', '1\n')])
- wt.add(['f'], ['f-id'])
- wt.commit('commit one', rev_id='1')
- wt.commit('commit two', rev_id='2')
-
- tree3 = wt.bzrdir.sprout('tree3').open_workingtree()
- self.build_tree_contents([('tree3/f', '1\n2\n3a\n')])
- tree3.commit('commit three a', rev_id='3a')
-
- tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
- tree2.merge_from_branch(tree3.branch)
- tree2.commit('commit three b', rev_id='3b')
-
- wt.merge_from_branch(tree2.branch)
- wt.commit('commit three c', rev_id='3c')
- tree2.commit('four-a', rev_id='4a')
-
- wt.merge_from_branch(tree2.branch)
- wt.commit('four-b', rev_id='4b')
+ builder = self.make_branch_builder('tree1')
+ builder.start_series()
+ builder.build_snapshot('1', None, [
+ ('add', ('', 'TREE_ROOT', 'directory', '')),
+ ('add', ('f', 'f-id', 'file', '1\n'))])
+ builder.build_snapshot('2', ['1'], [])
+ builder.build_snapshot('3a', ['2'], [
+ ('modify', ('f-id', '1\n2\n3a\n'))])
+ builder.build_snapshot('3b', ['2', '3a'], [
+ ('modify', ('f-id', '1\n2\n3a\n'))])
+ builder.build_snapshot('3c', ['2', '3b'], [
+ ('modify', ('f-id', '1\n2\n3a\n'))])
+ builder.build_snapshot('4a', ['3b'], [])
+ builder.build_snapshot('4b', ['3c', '4a'], [])
+ builder.finish_series()
+
+ # 1
+ # |
+ # 2-.
+ # |\ \
+ # | | 3a
+ # | |/
+ # | 3b
+ # |/|
+ # 3c4a
+ # |/
+ # 4b
mainline_revs = [None, '1', '2', '3c', '4b']
rev_nos = {'1':1, '2':2, '3c': 3, '4b':4}
@@ -1231,7 +1238,7 @@
'4a': '2.2.2', # second commit tree 2
'4b': '4', # merges 4a to main
}
- return mainline_revs, rev_nos, wt
+ return mainline_revs, rev_nos, builder.get_branch()
def test_get_view_revisions_forward(self):
"""Test the get_view_revisions method"""
@@ -1297,17 +1304,17 @@
def test_get_view_revisions_merge2(self):
"""Test get_view_revisions when there are merges"""
- mainline_revs, rev_nos, wt = self.make_tree_with_many_merges()
- wt.lock_read()
- self.addCleanup(wt.unlock)
+ mainline_revs, rev_nos, b = self.make_branch_with_many_merges()
+ b.lock_read()
+ self.addCleanup(b.unlock)
revisions = list(log.get_view_revisions(
- mainline_revs, rev_nos, wt.branch, 'forward'))
+ mainline_revs, rev_nos, b, 'forward'))
expected = [('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),
- ('3a', '2.1.1', 1), ('3b', '2.2.1', 1), ('4b', '4', 0),
+ ('3b', '2.2.1', 1), ('3a', '2.1.1', 2), ('4b', '4', 0),
('4a', '2.2.2', 1)]
self.assertEqual(expected, revisions)
revisions = list(log.get_view_revisions(
- mainline_revs, rev_nos, wt.branch, 'forward',
+ mainline_revs, rev_nos, b, 'forward',
include_merges=False))
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),
('4b', '4', 0)],
@@ -1315,9 +1322,9 @@
def test_file_id_for_range(self):
- mainline_revs, rev_nos, wt = self.make_tree_with_many_merges()
- wt.lock_read()
- self.addCleanup(wt.unlock)
+ mainline_revs, rev_nos, b = self.make_branch_with_many_merges()
+ b.lock_read()
+ self.addCleanup(b.unlock)
def rev_from_rev_id(revid, branch):
revspec = revisionspec.RevisionSpec.from_string('revid:%s' % revid)
@@ -1325,7 +1332,7 @@
def view_revs(start_rev, end_rev, file_id, direction):
revs = log.calculate_view_revisions(
- wt.branch,
+ b,
start_rev, # start_revision
end_rev, # end_revision
direction, # direction
@@ -1334,12 +1341,12 @@
)
return revs
- rev_3a = rev_from_rev_id('3a', wt.branch)
- rev_4b = rev_from_rev_id('4b', wt.branch)
- self.assertEqual([('3c', '3', 0), ('3a', '2.1.1', 1)],
+ rev_3a = rev_from_rev_id('3a', b)
+ rev_4b = rev_from_rev_id('4b', b)
+ self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1), ('3a', '2.1.1', 2)],
view_revs(rev_3a, rev_4b, 'f-id', 'reverse'))
# Note: 3c still appears before 3a here because of depth-based sorting
- self.assertEqual([('3c', '3', 0), ('3a', '2.1.1', 1)],
+ self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1), ('3a', '2.1.1', 2)],
view_revs(rev_3a, rev_4b, 'f-id', 'forward'))
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2009-06-29 15:07:51 +0000
+++ b/bzrlib/tests/test_repository.py 2009-08-17 20:53:59 +0000
@@ -486,6 +486,8 @@
_serializer = None
def supports_rich_root(self):
+ if self._format is not None:
+ return self._format.rich_root_data
return False
def get_graph(self):
@@ -542,11 +544,17 @@
# pair that it returns true on for the is_compatible static method
# check
dummy_a = DummyRepository()
+ dummy_a._format = RepositoryFormat()
dummy_b = DummyRepository()
+ dummy_b._format = RepositoryFormat()
repo = self.make_repository('.')
# hack dummies to look like repo somewhat.
dummy_a._serializer = repo._serializer
+ dummy_a._format.supports_tree_reference = repo._format.supports_tree_reference
+ dummy_a._format.rich_root_data = repo._format.rich_root_data
dummy_b._serializer = repo._serializer
+ dummy_b._format.supports_tree_reference = repo._format.supports_tree_reference
+ dummy_b._format.rich_root_data = repo._format.rich_root_data
repository.InterRepository.register_optimiser(InterDummy)
try:
# we should get the default for something InterDummy returns False
@@ -1008,14 +1016,17 @@
"""
broken_repo = self.make_broken_repository()
empty_repo = self.make_repository('empty-repo')
- # See bug https://bugs.launchpad.net/bzr/+bug/389141 for information
- # about why this was turned into expectFailure
- self.expectFailure('new Stream fetch fills in missing compression'
- ' parents (bug #389141)',
- self.assertRaises, (errors.RevisionNotPresent, errors.BzrCheckError),
- empty_repo.fetch, broken_repo)
- self.assertRaises((errors.RevisionNotPresent, errors.BzrCheckError),
- empty_repo.fetch, broken_repo)
+ try:
+ empty_repo.fetch(broken_repo)
+ except (errors.RevisionNotPresent, errors.BzrCheckError):
+ # Test successful: compression parent not being copied leads to
+ # error.
+ return
+ empty_repo.lock_read()
+ self.addCleanup(empty_repo.unlock)
+ text = empty_repo.texts.get_record_stream(
+ [('file2-id', 'rev3')], 'topological', True).next()
+ self.assertEqual('line\n', text.get_bytes_as('fulltext'))
class TestRepositoryPackCollection(TestCaseWithTransport):
@@ -1030,7 +1041,7 @@
def make_packs_and_alt_repo(self, write_lock=False):
"""Create a pack repo with 3 packs, and access it via a second repo."""
- tree = self.make_branch_and_tree('.')
+ tree = self.make_branch_and_tree('.', format=self.get_format())
tree.lock_write()
self.addCleanup(tree.unlock)
rev1 = tree.commit('one')
@@ -1346,7 +1357,7 @@
"""Tests for the packs repository Packer class."""
def test_pack_optimizes_pack_order(self):
- builder = self.make_branch_builder('.')
+ builder = self.make_branch_builder('.', format="1.9")
builder.start_series()
builder.build_snapshot('A', None, [
('add', ('', 'root-id', 'directory', None)),
=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py 2009-08-07 04:17:51 +0000
+++ b/bzrlib/tests/test_smart.py 2009-08-17 20:53:59 +0000
@@ -202,7 +202,7 @@
self.make_bzrdir('.')
request_class = bzrlib.smart.bzrdir.SmartServerRequestCreateRepository
request = request_class(backing)
- reference_bzrdir_format = bzrdir.format_registry.get('default')()
+ reference_bzrdir_format = bzrdir.format_registry.get('pack-0.92')()
reference_format = reference_bzrdir_format.repository_format
network_name = reference_format.network_name()
expected = SuccessfulSmartServerResponse(
@@ -247,17 +247,21 @@
subtrees = 'yes'
else:
subtrees = 'no'
+ if repo._format.supports_external_lookups:
+ external = 'yes'
+ else:
+ external = 'no'
if (smart.bzrdir.SmartServerRequestFindRepositoryV3 ==
self._request_class):
return SuccessfulSmartServerResponse(
- ('ok', '', rich_root, subtrees, 'no',
+ ('ok', '', rich_root, subtrees, external,
repo._format.network_name()))
elif (smart.bzrdir.SmartServerRequestFindRepositoryV2 ==
self._request_class):
# All tests so far are on formats, and for non-external
# repositories.
return SuccessfulSmartServerResponse(
- ('ok', '', rich_root, subtrees, 'no'))
+ ('ok', '', rich_root, subtrees, external))
else:
return SuccessfulSmartServerResponse(('ok', '', rich_root, subtrees))
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2009-08-04 04:36:34 +0000
+++ b/bzrlib/workingtree.py 2009-08-14 02:35:01 +0000
@@ -1893,8 +1893,8 @@
firstline = xml.split('\n', 1)[0]
if (not 'revision_id="' in firstline or
'format="7"' not in firstline):
- inv = self.branch.repository.deserialise_inventory(
- new_revision, xml)
+ inv = self.branch.repository._serializer.read_inventory_from_string(
+ xml, new_revision)
xml = self._create_basis_xml_from_inventory(new_revision, inv)
self._write_basis_inventory(xml)
except (errors.NoSuchRevision, errors.RevisionNotPresent):
More information about the bazaar-commits
mailing list