Rev 3805: Updates to the form of add_inventory_by_delta that landed in trunk. in http://people.ubuntu.com/~robertc/baz2.0/commit-iterchanges

Robert Collins robertc at robertcollins.net
Wed Mar 18 01:59:45 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/commit-iterchanges

------------------------------------------------------------
revno: 3805
revision-id: robertc at robertcollins.net-20090318015940-dwaazhc8jzq6upje
parent: robertc at robertcollins.net-20090318010802-33da0qgt2ed867qy
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit-iterchanges
timestamp: Wed 2009-03-18 12:59:40 +1100
message:
  Updates to the form of add_inventory_by_delta that landed in trunk.
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-03-18 01:08:02 +0000
+++ b/bzrlib/repository.py	2009-03-18 01:59:40 +0000
@@ -553,13 +553,11 @@
         self._any_changes = True
         return self._get_delta(ie, basis_inv, path), True, fingerprint
 
-    def record_iter_changes(self, tree, basis_tree, basis_revision_id,
-        iter_changes, _entry_factory=entry_factory):
+    def record_iter_changes(self, tree, basis_revision_id, iter_changes,
+        _entry_factory=entry_factory):
         """Record a new tree via iter_changes.
 
         :param tree: The tree to obtain text contents from for changed objects.
-        :param basis_tree: The basis tree this commit is being performed
-            against.
         :param basis_revision_id: The revision id of the tree the iter_changes
             has been generated against. Currently assumed to be the same
             as self.parents[0] - if it is not, errors may occur.

=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
--- a/bzrlib/tests/per_repository/test_commit_builder.py	2009-03-18 01:08:02 +0000
+++ b/bzrlib/tests/per_repository/test_commit_builder.py	2009-03-18 01:59:40 +0000
@@ -76,8 +76,8 @@
         try:
             builder = tree.branch.get_commit_builder([])
             try:
-                builder.record_iter_changes(tree, tree.basis_tree(),
-                    tree.last_revision(), tree.iter_changes(tree.basis_tree()))
+                builder.record_iter_changes(tree, tree.last_revision(),
+                    tree.iter_changes(tree.basis_tree()))
                 builder.finish_inventory()
             except:
                 builder.abort()
@@ -107,7 +107,7 @@
                 basis = tree.basis_tree()
                 last_rev = tree.last_revision()
                 changes = tree.iter_changes(basis)
-                builder.record_iter_changes(tree, basis, last_rev, changes)
+                builder.record_iter_changes(tree, last_rev, changes)
                 builder.finish_inventory()
             finally:
                 builder.abort()
@@ -179,8 +179,8 @@
                 return
             self.assertFalse(builder.random_revid)
             try:
-                builder.record_iter_changes(tree, tree.basis_tree(),
-                    tree.last_revision(), tree.iter_changes(tree.basis_tree()))
+                builder.record_iter_changes(tree, tree.last_revision(),
+                    tree.iter_changes(tree.basis_tree()))
                 builder.finish_inventory()
             except:
                 builder.abort()
@@ -253,12 +253,9 @@
         tree = self.make_branch_and_tree(".")
         old_revision_id = tree.commit('')
         tree.lock_write()
-        parent_tree = tree.basis_tree()
-        parent_tree.lock_read()
-        self.addCleanup(parent_tree.unlock)
         builder = tree.branch.get_commit_builder([old_revision_id])
         try:
-            builder.record_iter_changes(tree, parent_tree, old_revision_id, [])
+            builder.record_iter_changes(tree, old_revision_id, [])
             # Regardless of repository root behaviour we should consider this a
             # pointless commit.
             self.assertFalse(builder.any_changes())
@@ -396,8 +393,7 @@
                 delete_change = ('foo-id', ('foo', None), True, (True, False),
                     (tree.path2id(''), None), ('foo', None), ('file', None),
                     (False, None))
-                builder.record_iter_changes(tree, tree.basis_tree(), rev_id,
-                    [delete_change])
+                builder.record_iter_changes(tree, rev_id, [delete_change])
                 self.assertEqual(("foo", None, "foo-id", None),
                     builder._basis_delta[0])
                 self.assertTrue(builder.any_changes())
@@ -452,8 +448,7 @@
         try:
             builder = tree.branch.get_commit_builder([])
             try:
-                builder.record_iter_changes(tree, tree.basis_tree(),
-                    _mod_revision.NULL_REVISION,
+                builder.record_iter_changes(tree, _mod_revision.NULL_REVISION,
                     tree.iter_changes(tree.basis_tree()))
                 builder.finish_inventory()
                 rev_id = builder.commit('foo bar')
@@ -808,8 +803,7 @@
                 parent_invs.append(tree.branch.repository.revision_tree(
                     parent_id).inventory)
             changes = list(tree.iter_changes(parent_tree))
-            builder.record_iter_changes(tree, parent_tree, parent_ids[0],
-                changes)
+            builder.record_iter_changes(tree, parent_ids[0], changes)
             delta = builder._basis_delta
             delta_dict = dict((change[2], change) for change in delta)
             file_id = tree.path2id(new_name)




More information about the bazaar-commits mailing list