Rev 3178: Stash the journalled inventory validator in Inventory objects during deserialisation. in http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
Robert Collins
robertc at robertcollins.net
Sun Jan 6 23:31:25 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
------------------------------------------------------------
revno: 3178
revision-id:robertc at robertcollins.net-20080106233119-rci5iui4sqkp3288
parent: robertc at robertcollins.net-20080106232051-ry3g48jurtr1w2bw
committer: Robert Collins <robertc at robertcollins.net>
branch nick: inventory.journalled
timestamp: Mon 2008-01-07 10:31:19 +1100
message:
Stash the journalled inventory validator in Inventory objects during deserialisation.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/journalled_inventory.py journalled_inventory-20080103020931-0ht5n40kwc0p7fy1-1
bzrlib/tests/test_journalled_inv.py test_journalled_inv.-20080103012121-ny2w9slze5jgty8i-1
=== modified file 'NEWS'
--- a/NEWS 2008-01-06 20:04:22 +0000
+++ b/NEWS 2008-01-06 23:31:19 +0000
@@ -128,6 +128,15 @@
* get_parent_map now always provides tuples as its output. (Aaron Bentley)
+ * New attribute on ``bzrlib.inventory.Inventory`` ``validator`` set
+ when the inventory was loaded from a repository using the journalled
+ inventory feature. (Robert Collins)
+
+ * New support module ``bzrlib.journalled_inventory`` provides support for
+ inventories which are delta compressed at the object level rather than
+ textually, making delta composition and commit faster with them.
+ (Robert Collins)
+
* Parent Providers should now implement ``get_parent_map`` returning a
dictionary instead of ``get_parents`` returning a list.
``get_parents`` is now considered deprecated. (John Arbash Meinel)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2008-01-04 02:10:02 +0000
+++ b/bzrlib/inventory.py 2008-01-06 23:31:19 +0000
@@ -857,6 +857,7 @@
>>> inv.add(InventoryFile('123-123', 'hello.c', 'TREE_ROOT-12345678-12345678'))
InventoryFile('123-123', 'hello.c', parent_id='TREE_ROOT-12345678-12345678', sha1=None, len=None)
"""
+
def __init__(self, root_id=ROOT_ID, revision_id=None):
"""Create or read an inventory.
@@ -874,6 +875,10 @@
self.root = None
self._byid = {}
self.revision_id = revision_id
+ # only set by repositories using journalled inventories, and only valid
+ # until the inventory is modified (the validity constraint applies to
+ # the revision_id attribute too).
+ self.validator = None
def __repr__(self):
return "<Inventory object at %x, contents=%r>" % (id(self), self._byid)
=== modified file 'bzrlib/journalled_inventory.py'
--- a/bzrlib/journalled_inventory.py 2008-01-06 23:20:51 +0000
+++ b/bzrlib/journalled_inventory.py 2008-01-06 23:31:19 +0000
@@ -231,6 +231,7 @@
result.add(entry_factory[content[0]](
content, name, parent_id, file_id, last_modified))
result.revision_id = self.version
+ result.validator = self.get_validator()
return result
=== modified file 'bzrlib/tests/test_journalled_inv.py'
--- a/bzrlib/tests/test_journalled_inv.py 2008-01-06 23:20:51 +0000
+++ b/bzrlib/tests/test_journalled_inv.py 2008-01-06 23:31:19 +0000
@@ -569,6 +569,8 @@
self.assertIsInstance(serialised, str)
self.assertEqual(expected, serialised)
self.assertEqual(validator, journal_entry.get_validator())
+ # This may benefit from a dedicated test:
+ self.assertEqual(validator, inv.validator)
class TestContent(TestCase):
More information about the bazaar-commits
mailing list