/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

merge robert, debugging

Show diffs side-by-side

added added

removed removed

Lines of Context:
424
424
        finally:
425
425
            state.unlock()
426
426
 
 
427
    def test_set_path_id_with_parents(self):
 
428
        """Set the root file id in a dirstate with parents"""
 
429
        mt = self.make_branch_and_tree('mt')
 
430
        # may need to set the root when the default format is one where it's
 
431
        # not TREE_ROOT
 
432
        mt.commit('foo', rev_id='parent-revid')
 
433
        rt = mt.branch.repository.revision_tree('parent-revid')
 
434
        state = dirstate.DirState.initialize('dirstate')
 
435
        try:
 
436
            state.set_parent_trees([('parent-revid', rt)], ghosts=[])
 
437
            state.set_path_id('', 'foobarbaz')
 
438
            # now see that it is what we expected
 
439
            expected_rows = [
 
440
                (('', '', 'TREE_ROOT'),
 
441
                    [('a', '', 0, False, ''),
 
442
                     ('d', '', 0, False, 'parent-revid'),
 
443
                     ]),
 
444
                (('', '', 'foobarbaz'),
 
445
                    [('d', '', 0, False, ''),
 
446
                     ('a', '', 0, False, ''),
 
447
                     ]),
 
448
                ]
 
449
            self.assertEqual(expected_rows, list(state._iter_entries()))
 
450
            # should work across save too
 
451
            state.save()
 
452
        finally:
 
453
            state.unlock()
 
454
        # now flush & check we get the same
 
455
        state = dirstate.DirState.on_file('dirstate')
 
456
        state.lock_read()
 
457
        try:
 
458
            self.assertEqual(expected_rows, list(state._iter_entries()))
 
459
        finally:
 
460
            state.unlock()
 
461
 
427
462
    def test_set_parent_trees_no_content(self):
428
463
        # set_parent_trees is a slow but important api to support.
429
464
        tree1 = self.make_branch_and_memory_tree('tree1')