Rev 5639: It turns out that _observed_sha1 was not setting the size field. in http://bazaar.launchpad.net/~jameinel/bzr/2.3-build-cache-sha-740932
John Arbash Meinel
john at arbash-meinel.com
Mon Apr 4 12:34:21 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.3-build-cache-sha-740932
------------------------------------------------------------
revno: 5639
revision-id: john at arbash-meinel.com-20110404123413-vmd0xo9yrx6f3uza
parent: john at arbash-meinel.com-20110404115739-w4v1i0t9n2us52f1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-build-cache-sha-740932
timestamp: Mon 2011-04-04 14:34:13 +0200
message:
It turns out that _observed_sha1 was not setting the size field.
I don't know why this didn't matter for commit, but maybe the size was getting
set somewhere else. apply_inventory_delta from TreeTransform wasn't setting it.
Maybe there is a different bug there. Regardless, we now set the size field
so I can be sure that we aren't re-computing the sha values for all the
files which are old enough.
Now to test on Linux, because the rename is probably going to change the
ctime there.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-04-04 11:24:50 +0000
+++ b/bzrlib/dirstate.py 2011-04-04 12:34:13 +0000
@@ -1745,8 +1745,8 @@
self._sha_cutoff_time()
if (stat_value.st_mtime < self._cutoff_time
and stat_value.st_ctime < self._cutoff_time):
- entry[1][0] = ('f', sha1, entry[1][0][2], entry[1][0][3],
- packed_stat)
+ entry[1][0] = ('f', sha1, stat_value.st_size, entry[1][0][3],
+ packed_stat)
self._dirblock_state = DirState.IN_MEMORY_MODIFIED
def _sha_cutoff_time(self):
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py 2011-04-04 11:24:50 +0000
+++ b/bzrlib/tests/test_transform.py 2011-04-04 12:34:13 +0000
@@ -2083,17 +2083,20 @@
# tree
entry1 = state._get_entry(0, path_utf8='file1')
self.assertEqual(entry1_sha, entry1[1][0][1])
- entry1_packed_stat = entry1[1][0][-1]
+ # The 'size' field must also be set.
+ self.assertEqual(25, entry1[1][0][2])
+ entry1_state = entry1[1][0]
entry2 = state._get_entry(0, path_utf8='dir/file2')
self.assertEqual(entry2_sha, entry2[1][0][1])
- entry2_packed_stat = entry2[1][0][-1]
+ self.assertEqual(29, entry2[1][0][2])
+ entry2_state = entry2[1][0]
# Now, make sure that we don't have to re-read the content. The
# packed_stat should match exactly.
self.assertEqual(entry1_sha, target.get_file_sha1('file1-id', 'file1'))
self.assertEqual(entry2_sha,
target.get_file_sha1('file2-id', 'dir/file2'))
- self.assertEqual(entry1_packed_stat, entry1[1][0][-1])
- self.assertEqual(entry2_packed_stat, entry2[1][0][-1])
+ self.assertEqual(entry1_state, entry1[1][0])
+ self.assertEqual(entry2_state, entry2[1][0])
class TestCommitTransform(tests.TestCaseWithTransport):
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2011-04-04 11:24:50 +0000
+++ b/bzrlib/transform.py 2011-04-04 12:34:13 +0000
@@ -1867,6 +1867,14 @@
it doesn't know anything about the files we are updating. Also, we want
to do this as late as possible, so that most entries end up cached.
"""
+ # TODO: this doesn't update the stat information for directories. So
+ # the first 'bzr status' will still need to rewrite
+ # .bzr/checkout/dirstate. However, we at least don't need to
+ # re-read all of the files.
+ # TODO: If the operation took a while, we could do a time.sleep(3) here
+ # to allow the clock to tick over and ensure we won't have any
+ # problems. (we could observe start time, and finish time, and if
+ # it is less than eg 10% overhead, add a sleep call.)
paths = FinalPaths(self)
for trans_id, observed in self._observed_sha1s.iteritems():
path = paths.get_path(trans_id)
More information about the bazaar-commits
mailing list