Rev 5757: Add a test for the accelerator tree code path. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-transform-cache-sha-740932

John Arbash Meinel john at arbash-meinel.com
Mon Apr 4 14:47:15 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.4-transform-cache-sha-740932

------------------------------------------------------------
revno: 5757
revision-id: john at arbash-meinel.com-20110404144707-jgs06t8xhaqfc6to
parent: john at arbash-meinel.com-20110404143950-0nsclze34wz131a5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-transform-cache-sha-740932
timestamp: Mon 2011-04-04 16:47:07 +0200
message:
  Add a test for the accelerator tree code path.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2011-04-04 14:29:22 +0000
+++ b/bzrlib/tests/test_transform.py	2011-04-04 14:47:07 +0000
@@ -1941,6 +1941,18 @@
         self.addCleanup(target.unlock)
         self.assertEqual([], list(target.iter_changes(revision_tree)))
 
+    def test_build_tree_accelerator_tree_observes_sha1(self):
+        source = self.create_ab_tree()
+        sha1 = osutils.sha_string('A')
+        target = self.make_branch_and_tree('target')
+        target.lock_write()
+        self.addCleanup(target.unlock)
+        state = target.current_dirstate()
+        state._cutoff_time = time.time() + 60
+        build_tree(source.basis_tree(), target, source)
+        entry = state._get_entry(0, path_utf8='file1')
+        self.assertEqual(sha1, entry[1][0][1])
+
     def test_build_tree_accelerator_tree_missing_file(self):
         source = self.create_ab_tree()
         os.unlink('source/file1')

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2011-04-04 14:39:50 +0000
+++ b/bzrlib/transform.py	2011-04-04 14:47:07 +0000
@@ -2611,7 +2611,7 @@
                     contents = filtered_output_bytes(contents, filters,
                         ContentFilterContext(tree_path, tree))
                 try:
-                    tt.create_file(contents, trans_id)
+                    tt.create_file(contents, trans_id, sha1=text_sha1)
                 finally:
                     try:
                         contents.close()



More information about the bazaar-commits mailing list