Rev 4815: (jam) Fix CommitBuilder.inv_sha1 when using record_iter_changes. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Nov 19 17:45:32 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4815 [merge]
revision-id: pqm at pqm.ubuntu.com-20091119174527-7449pcexzj7mav1p
parent: pqm at pqm.ubuntu.com-20091119164131-pg4ky6zrxe6kpzhq
parent: john at arbash-meinel.com-20091119150647-2m1l640b6ka9rniq
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-11-19 17:45:27 +0000
message:
(jam) Fix CommitBuilder.inv_sha1 when using record_iter_changes.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
=== modified file 'NEWS'
--- a/NEWS 2009-11-19 16:41:31 +0000
+++ b/NEWS 2009-11-19 17:45:27 +0000
@@ -143,6 +143,14 @@
* The fix for bug #186920 accidentally broke compatibility with python
2.4. (Vincent Ladeuil, #475585)
+* Using ``Repository.get_commit_builder().record_iter_changes()`` now
+ correctly sets ``self.inv_sha1`` to a sha1 string and
+ ``self.new_inventory`` to an Inventory instance after calling
+ ``self.finish_inventory()``. (Previously it accidently set both values
+ as a tuple on ``self.inv_sha1``. This was missed because
+ ``repo.add_revision`` ignores the supplied inventory sha1 and recomputes
+ the sha1 from the repo directly. (John Arbash Meinel)
+
Documentation
*************
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-10-28 00:12:03 +0000
+++ b/bzrlib/repository.py 2009-11-19 15:06:47 +0000
@@ -206,7 +206,10 @@
# an inventory delta was accumulated without creating a new
# inventory.
basis_id = self.basis_delta_revision
- self.inv_sha1 = self.repository.add_inventory_by_delta(
+ # We ignore the 'inventory' returned by add_inventory_by_delta
+ # because self.new_inventory is used to hint to the rest of the
+ # system what code path was taken
+ self.inv_sha1, _ = self.repository.add_inventory_by_delta(
basis_id, self._basis_delta, self._new_revision_id,
self.parents)
else:
=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
--- a/bzrlib/tests/per_repository/test_commit_builder.py 2009-08-11 02:45:36 +0000
+++ b/bzrlib/tests/per_repository/test_commit_builder.py 2009-11-19 15:06:47 +0000
@@ -894,7 +894,13 @@
self.assertTrue(version_recorded)
else:
self.assertFalse(version_recorded)
+ self.assertIs(None, builder.new_inventory)
builder.finish_inventory()
+ inv_key = (builder._new_revision_id,)
+ inv_sha1 = tree.branch.repository.inventories.get_sha1s(
+ [inv_key])[inv_key]
+ self.assertEqual(inv_sha1, builder.inv_sha1)
+ self.assertIs(None, builder.new_inventory)
new_inventory = builder.revision_tree().inventory
new_entry = new_inventory[file_id]
if delta_against_basis:
More information about the bazaar-commits
mailing list