~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: James Westby
  • Date: 2008-08-01 16:10:59 UTC
  • mto: This revision was merged to the branch mainline in revision 3609.
  • Revision ID: jw+debian@jameswestby.net-20080801161059-xbtyoclmjhaf13qz
Add a test for creating hardlinks as well.

Also, don't keep state, but calculate all of the kind changes
at apply time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1277
1277
        self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1278
1278
                "file")
1279
1279
 
 
1280
    def test_dir_to_hardlink(self):
 
1281
        wt = self.make_branch_and_tree('.')
 
1282
        self.build_tree(['foo/', 'foo/bar'])
 
1283
        wt.add(['foo', 'foo/bar'])
 
1284
        wt.commit("one")
 
1285
        tt = TreeTransform(wt)
 
1286
        self.addCleanup(tt.finalize)
 
1287
        foo_trans_id = tt.trans_id_tree_path("foo")
 
1288
        bar_trans_id = tt.trans_id_tree_path("foo/bar")
 
1289
        tt.delete_contents(foo_trans_id)
 
1290
        tt.delete_versioned(bar_trans_id)
 
1291
        self.build_tree(['baz'])
 
1292
        tt.create_hardlink("baz", foo_trans_id)
 
1293
        tt.apply()
 
1294
        self.failUnlessExists("foo")
 
1295
        self.failUnlessExists("baz")
 
1296
        wt.lock_read()
 
1297
        self.addCleanup(wt.unlock)
 
1298
        self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
 
1299
                "file")
 
1300
 
1280
1301
 
1281
1302
class TransformGroup(object):
1282
1303