~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

Add new_file(sha1=XXX) and pass that down to create_file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        self.assertEqualStat(o_st_val, new_st_val)
204
204
        self.assertNotEqual(st_val.st_mtime, new_st_val.st_mtime)
205
205
 
 
206
    def test_new_file_caches_sha1(self):
 
207
        trans, root = self.get_transform()
 
208
        self.wt.lock_tree_write()
 
209
        self.addCleanup(self.wt.unlock)
 
210
        content = ['just some content\n']
 
211
        sha1 = osutils.sha_strings(content)
 
212
        # Roll back the clock
 
213
        transform._creation_mtime = creation_mtime = time.time() - 20.0
 
214
        trans_id = trans.new_file('file1', root, content, file_id='file1-id',
 
215
                                  sha1=sha1)
 
216
        st_val = osutils.lstat(trans._limbo_name(trans_id))
 
217
        o_sha1, o_st_val = trans._observed_sha1s[trans_id]
 
218
        self.assertEqual(o_sha1, sha1)
 
219
        self.assertEqualStat(o_st_val, st_val)
 
220
 
206
221
    def test_create_files_same_timestamp(self):
207
222
        transform, root = self.get_transform()
208
223
        self.wt.lock_tree_write()