Rev 3183: Set the revision of the root of an inventory when loading non rich root journals into inventory objects. in http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
Robert Collins
robertc at robertcollins.net
Tue Jan 8 02:51:38 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled
------------------------------------------------------------
revno: 3183
revision-id:robertc at robertcollins.net-20080108025132-67i0sx84fqh8fdct
parent: robertc at robertcollins.net-20080107221727-fe6kr0sb7j5bprpk
committer: Robert Collins <robertc at robertcollins.net>
branch nick: inventory.journalled
timestamp: Tue 2008-01-08 13:51:32 +1100
message:
Set the revision of the root of an inventory when loading non rich root journals into inventory objects.
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-07 22:17:27 +0000
+++ b/bzrlib/journalled_inventory.py 2008-01-08 02:51:32 +0000
@@ -210,10 +210,11 @@
if file_id != 'TREE_ROOT':
raise errors.BzrError(
'file_id %s is not TREE_ROOT for /' % file_id)
- if last_modified is not None:
+ if last_modified is not NULL_REVISION:
raise errors.BzrError(
'Version present for / in %s' % file_id)
- last_modified = None
+ self.by_id[file_id] = (utf8_path, file_id, parent_id,
+ self.version, content)
else:
if last_modified[-1] == ':':
raise errors.BzrError(
=== modified file 'bzrlib/tests/test_journalled_inv.py'
--- a/bzrlib/tests/test_journalled_inv.py 2008-01-07 22:15:40 +0000
+++ b/bzrlib/tests/test_journalled_inv.py 2008-01-08 02:51:32 +0000
@@ -513,6 +513,18 @@
'something', '', NULL_REVISION, '', entries, True, False)
self.assertRaises(errors.BzrError, journal_entry.to_inventory)
+ def test_non_rich_root_to_inventory_takes_inventory_version(self):
+ entries = {
+ # current root:
+ 'TREE_ROOT': ('/', 'TREE_ROOT', None, NULL_REVISION, ('dir',)),
+ }
+ journal_entry = journalled_inventory._JournalEntry(
+ 'something', '6215f52d561aff019a4f2a0612f3027e1cbac580',
+ NULL_REVISION, '', entries, False, False)
+ inv = journal_entry.to_inventory()
+ self.assertEqual(inv.revision_id, inv.root.revision)
+ self.assertEqual('something', inv.revision_id)
+
def test_to_inventory_torture(self):
# this journal is crafted to have all the following:
# - deletes
More information about the bazaar-commits
mailing list