Rev 3184: Ignore versioned roots when writing to a non versioned root journal to match the xml serializer behaviour. in http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
Robert Collins
robertc at robertcollins.net
Tue Jan 8 04:01:45 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
------------------------------------------------------------
revno: 3184
revision-id:robertc at robertcollins.net-20080108040140-p81v3wsny42twxrh
parent: robertc at robertcollins.net-20080108025132-67i0sx84fqh8fdct
committer: Robert Collins <robertc at robertcollins.net>
branch nick: inventory.journalled
timestamp: Tue 2008-01-08 15:01:40 +1100
message:
Ignore versioned roots when writing to a non versioned root journal to match the xml serializer behaviour.
modified:
bzrlib/journalled_inventory.py journalled_inventory-20080103020931-0ht5n40kwc0p7fy1-1
bzrlib/tests/test_journalled_inv.py test_journalled_inv.-20080103012121-ny2w9slze5jgty8i-1
=== modified file 'bzrlib/journalled_inventory.py'
--- a/bzrlib/journalled_inventory.py 2008-01-08 02:51:32 +0000
+++ b/bzrlib/journalled_inventory.py 2008-01-08 04:01:40 +0000
@@ -332,9 +332,7 @@
if file_id != 'TREE_ROOT':
raise errors.BzrError(
'file_id %s is not TREE_ROOT for /' % file_id)
- if last_modified is not None:
- raise errors.BzrError(
- 'Version present for / in %s' % file_id)
+ # discard any version and record NULL.
last_modified = NULL_REVISION
if last_modified is None:
raise errors.BzrError("no version for fileid %s" % file_id)
@@ -441,7 +439,7 @@
if newpath_utf8 == '/' and not self._versioned_root and (
last_modified != 'null:' or file_id != 'TREE_ROOT'):
raise errors.BzrError("Versioned root found: %r" % line)
- elif last_modified[-1] == ':':
+ elif newpath_utf8 != 'None' and last_modified[-1] == ':':
raise errors.BzrError('special revisionid found: %r' % line)
if not self._tree_references and content.startswith('tree\x00'):
raise errors.BzrError("Tree reference found: %r" % line)
=== modified file 'bzrlib/tests/test_journalled_inv.py'
--- a/bzrlib/tests/test_journalled_inv.py 2008-01-08 02:51:32 +0000
+++ b/bzrlib/tests/test_journalled_inv.py 2008-01-08 04:01:40 +0000
@@ -168,7 +168,7 @@
self.assertRaises(errors.BzrError,
journal.delta_to_lines, NULL_REVISION, "", 'entry-version', delta)
- def test_nonrichroot_versioned_root_errors(self):
+ def test_nonrichroot_versioned_root_ignores_version(self):
old_inv = Inventory(None)
new_inv = Inventory(None)
root = new_inv.make_entry('directory', '', None, 'TREE_ROOT')
@@ -177,8 +177,10 @@
delta = inventory.make_inv_delta(old_inv, new_inv)
journal = journalled_inventory.InventoryJournal(versioned_root=False,
tree_references=True)
- self.assertRaises(errors.BzrError,
- journal.delta_to_lines, NULL_REVISION, "", 'entry-version', delta)
+ self.assertEqual((StringIO(root_only_unversioned).readlines(),
+ '3fccf5120c89399c7690e24b5647bbf55128e26b',
+ '3fccf5120c89399c7690e24b5647bbf55128e26b'),
+ journal.delta_to_lines(NULL_REVISION, "", 'entry-version', delta))
def test_nonrichroot_non_TREE_ROOT_id_errors(self):
old_inv = Inventory(None)
More information about the bazaar-commits
mailing list