~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2007-04-20 03:00:57 UTC
  • mfrom: (2432 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: andrew.bennetts@canonical.com-20070420030057-cg0z7spio1stbtpo
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
 
181
181
    def get_tree_with_subdirs_and_all_content_types(self):
182
182
        """Return a test tree with subdirs and all content types.
 
183
        See get_tree_with_subdirs_and_all_supported_content_types for details.
 
184
        """
 
185
        return self.get_tree_with_subdirs_and_all_supported_content_types(True)
 
186
 
 
187
    def get_tree_with_subdirs_and_all_supported_content_types(self, symlinks):
 
188
        """Return a test tree with subdirs and all supported content types.
 
189
        Some content types may not be created on some platforms
 
190
        (like symlinks on native win32)
 
191
 
 
192
        :param  symlinks:   control is symlink should be created in the tree.
 
193
                            Note: if you wish to automatically set this
 
194
                            parameters depending on underlying system,
 
195
                            please use value returned
 
196
                            by bzrlib.osutils.has_symlinks() function.
183
197
 
184
198
        The returned tree has the following inventory:
185
199
            [('', inventory.ROOT_ID),
186
200
             ('0file', '2file'),
187
201
             ('1top-dir', '1top-dir'),
188
202
             (u'2utf\u1234file', u'0utf\u1234file'),
189
 
             ('symlink', 'symlink'),
 
203
             ('symlink', 'symlink'),            # only if symlinks arg is True
190
204
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir'),
191
205
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir')]
192
 
        where each component has the type of its name - i.e. '1file..' is afile.
 
206
        where each component has the type of its name -
 
207
        i.e. '1file..' is afile.
193
208
 
194
209
        note that the order of the paths and fileids is deliberately 
195
210
        mismatched to ensure that the result order is path based.
215
230
                'This platform does not support unicode file paths.')
216
231
        tree.add(paths, ids)
217
232
        tt = transform.TreeTransform(tree)
218
 
        root_transaction_id = tt.trans_id_tree_path('')
219
 
        tt.new_symlink('symlink',
220
 
            root_transaction_id, 'link-target', 'symlink')
 
233
        if symlinks:
 
234
            root_transaction_id = tt.trans_id_tree_path('')
 
235
            tt.new_symlink('symlink',
 
236
                root_transaction_id, 'link-target', 'symlink')
221
237
        tt.apply()
222
238
        return self.workingtree_to_test_tree(tree)
223
239