~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_parents.py

  • Committer: Robert Collins
  • Date: 2007-10-23 22:14:32 UTC
  • mto: (2592.6.3 repository)
  • mto: This revision was merged to the branch mainline in revision 2967.
  • Revision ID: robertc@robertcollins.net-20071023221432-j8zndh1oiegql3cu
* Commit updates the state of the working tree via a delta rather than
  supplying entirely new basis trees. For commit of a single specified file
  this reduces the wall clock time for commit by roughly a 30%.
  (Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
 
261
261
    def assertDeltaApplicationResultsInExpectedBasis(self, tree, revid, delta,
262
262
        expected_inventory):
263
 
        tree.update_basis_by_delta(revid, delta)
 
263
        tree.lock_write()
 
264
        try:
 
265
            tree.update_basis_by_delta(revid, delta)
 
266
        finally:
 
267
            tree.unlock()
264
268
        # check the last revision was adjusted to rev_id
265
269
        self.assertEqual(revid, tree.last_revision())
266
270
        # check the parents are what we expect
354
358
                parents.append(extra_parent)
355
359
            tree.set_parent_ids(parents)
356
360
        self.fake_up_revision(tree, new_revid, new_shape)
 
361
        # give tree an inventory of new_shape
 
362
        tree._write_inventory(new_shape)
357
363
        self.assertDeltaApplicationResultsInExpectedBasis(tree, new_revid,
358
364
            delta, new_shape)
359
365
        osutils.rmtree('tree')
575
581
        self.add_link(new_shape, new_revid, 'link-id-B', 'root-id', 'B', 'C')
576
582
        self.assertTransitionFromBasisToShape(basis_shape, old_revid,
577
583
            new_shape, new_revid)
 
584
 
 
585
    def test_move_moves_children_recursively(self):
 
586
        old_revid = 'old-parent'
 
587
        basis_shape = Inventory(root_id=None)
 
588
        self.add_dir(basis_shape, old_revid, 'root-id', None, '')
 
589
        self.add_dir(basis_shape, old_revid, 'dir-id-A', 'root-id', 'A')
 
590
        self.add_dir(basis_shape, old_revid, 'dir-id-B', 'dir-id-A', 'B')
 
591
        self.add_link(basis_shape, old_revid, 'link-id-C', 'dir-id-B', 'C', 'D')
 
592
        new_revid = 'new-parent'
 
593
        new_shape = Inventory(root_id=None)
 
594
        self.add_new_root(new_shape, old_revid, new_revid)
 
595
        # the moved path:
 
596
        self.add_dir(new_shape, new_revid, 'dir-id-A', 'root-id', 'B')
 
597
        # unmoved children.
 
598
        self.add_dir(new_shape, old_revid, 'dir-id-B', 'dir-id-A', 'B')
 
599
        self.add_link(new_shape, old_revid, 'link-id-C', 'dir-id-B', 'C', 'D')
 
600
        self.assertTransitionFromBasisToShape(basis_shape, old_revid,
 
601
            new_shape, new_revid)