~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import tempfile
21
21
 
22
22
from bzrlib import (
23
 
    bzrdir,
 
23
    controldir,
24
24
    dirstate,
25
25
    errors,
26
26
    inventory,
31
31
    tests,
32
32
    workingtree_4,
33
33
    )
34
 
from bzrlib.transport import memory
35
34
from bzrlib.tests import (
36
35
    features,
37
36
    test_osutils,
65
64
    _native_to_unicode = None # Not used yet
66
65
 
67
66
    def setUp(self):
68
 
        tests.TestCaseWithTransport.setUp(self)
69
 
 
 
67
        super(TestCaseWithDirState, self).setUp()
70
68
        self.overrideAttr(osutils,
71
69
                          '_selected_dir_reader', self._dir_reader_class())
72
70
 
2444
2442
    """A minimal api to get InventoryRevisionTree to work."""
2445
2443
 
2446
2444
    def __init__(self):
2447
 
        default_format = bzrdir.format_registry.make_bzrdir('default')
 
2445
        default_format = controldir.format_registry.make_bzrdir('default')
2448
2446
        self._format = default_format.repository_format
2449
2447
 
2450
2448
    def lock_read(self):
2480
2478
    def create_tree_from_shape(self, rev_id, shape):
2481
2479
        dir_ids = {'': 'root-id'}
2482
2480
        inv = inventory.Inventory('root-id', rev_id)
2483
 
        for path, file_id in shape:
 
2481
        for info in shape:
 
2482
            if len(info) == 2:
 
2483
                path, file_id = info
 
2484
                ie_rev_id = rev_id
 
2485
            else:
 
2486
                path, file_id, ie_rev_id = info
2484
2487
            if path == '':
2485
2488
                # Replace the root entry
2486
2489
                del inv._byid[inv.root.file_id]
2488
2491
                inv._byid[file_id] = inv.root
2489
2492
                dir_ids[''] = file_id
2490
2493
                continue
2491
 
            inv.add(self.path_to_ie(path, file_id, rev_id, dir_ids))
 
2494
            inv.add(self.path_to_ie(path, file_id, ie_rev_id, dir_ids))
2492
2495
        return revisiontree.InventoryRevisionTree(_Repo(), inv, rev_id)
2493
2496
 
2494
2497
    def create_empty_dirstate(self):
2617
2620
            target=[('file', 'file-id')],
2618
2621
            )
2619
2622
 
 
2623
    def test_add_file_in_empty_dir_not_matching_active_state(self):
 
2624
        state = self.assertUpdate(
 
2625
                active=[],
 
2626
                basis=[('dir/', 'dir-id')],
 
2627
                target=[('dir/', 'dir-id', 'basis'), ('dir/file', 'file-id')],
 
2628
                )
 
2629
 
2620
2630
    def test_add_file_missing_in_active_state(self):
2621
2631
        state = self.assertUpdate(
2622
2632
            active=[],