~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_inv.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-13 05:14:24 UTC
  • mfrom: (3936.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090113051424-nrk3zkfe09h46i9y
(mbp) merge 1.11 and advance to 1.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
        self.addCleanup(tree.unlock)
125
125
        self.assertEqual(set([]), tree.paths2ids(['file'],
126
126
                         require_versioned=False))
 
127
 
 
128
    def _make_canonical_test_tree(self, commit=True):
 
129
        # make a tree used by all the 'canonical' tests below.
 
130
        work_tree = self.make_branch_and_tree('tree')
 
131
        self.build_tree(['tree/dir/', 'tree/dir/file'])
 
132
        work_tree.add(['dir', 'dir/file'])
 
133
        if commit:
 
134
            work_tree.commit('commit 1')
 
135
        return work_tree
 
136
 
 
137
    def test_canonical_path(self):
 
138
        work_tree = self._make_canonical_test_tree()
 
139
        self.assertEqual(work_tree.get_canonical_inventory_path('Dir/File'), 'dir/file')
 
140
 
 
141
    def test_canonical_path_before_commit(self):
 
142
        work_tree = self._make_canonical_test_tree(False)
 
143
        # note: not committed.
 
144
        self.assertEqual(work_tree.get_canonical_inventory_path('Dir/File'), 'dir/file')
 
145
 
 
146
    def test_canonical_path_dir(self):
 
147
        # check it works when asked for just the directory portion.
 
148
        work_tree = self._make_canonical_test_tree()
 
149
        self.assertEqual(work_tree.get_canonical_inventory_path('Dir'), 'dir')
 
150
 
 
151
    def test_canonical_path_root(self):
 
152
        work_tree = self._make_canonical_test_tree()
 
153
        self.assertEqual(work_tree.get_canonical_inventory_path(''), '')
 
154
        self.assertEqual(work_tree.get_canonical_inventory_path('/'), '/')
 
155
 
 
156
    def test_canonical_path_invalid_all(self):
 
157
        work_tree = self._make_canonical_test_tree()
 
158
        self.assertEqual(work_tree.get_canonical_inventory_path('foo/bar'), 'foo/bar')
 
159
 
 
160
    def test_canonical_invalid_child(self):
 
161
        work_tree = self._make_canonical_test_tree()
 
162
        self.assertEqual(work_tree.get_canonical_inventory_path('Dir/None'), 'dir/None')