~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_baz_import.py

  • Committer: Aaron Bentley
  • Date: 2006-05-31 03:56:23 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20060531035623-bf3599f8e8069aa5
Add test that type changes are not supported in bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
        os.mkdir(os.path.join(self._tmpdir, 'tree'))
136
136
        tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
137
137
                               self._import_symlink)
138
 
        os.symlink('missing-file-name',
139
 
                   os.path.join(self._tmpdir, 'tree', 'alink'))
 
138
        link_path = os.path.join(self._tmpdir, 'tree', 'alink')
 
139
        os.symlink('missing-file-name', link_path)
140
140
        tree.add_tag('alink')
141
141
        id_file = open(os.path.join(tree, '.arch-ids', 'alink.id'), 'w')
142
142
        id_file.write('symlink_tag\n')
144
144
        msg = tree.log_message()
145
145
        msg["summary"] = "Import with a symlink"
146
146
        tree.import_(msg)
 
147
        os.unlink(link_path)
 
148
        f = file(link_path, 'w')
 
149
        f.write('Not a symlink no more!')
 
150
        f.close()
 
151
        msg = tree.log_message()
 
152
        msg["summary"] = "Turn a symlink into a file"
 
153
        tree.commit(msg)
147
154
        shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
148
155
 
149
156
    def make_empty_import(self):
385
392
        # self.assertEqual(branch.missing_revisions(branch3), [])
386
393
        
387
394
    def test_import_symlink(self):
388
 
        import_version('output', pybaz.Version(self._baz._import_symlink))
 
395
        import_version('output', pybaz.Version(self._baz._import_symlink), 
 
396
                       max_count=1)
389
397
        # expected results:
390
 
        # one commit, no files, revision identifier of 
 
398
        # two commits, no files, revision identifier of 
391
399
        # 'demo@DONOTUSE_c--import--0--base-0'
392
400
        branch = Branch.open('output')
393
401
        self.assertEqual(branch.revision_history(),
394
402
                         [self._baz._import_symlink_bzr])
395
403
        rev = branch.repository.get_revision(self._baz._import_symlink_bzr)
396
404
        # and again.
397
 
        import_version('output2', pybaz.Version(self._baz._import_symlink))
 
405
        import_version('output2', pybaz.Version(self._baz._import_symlink),
 
406
                       max_count=1)
398
407
        branch2 = Branch.open('output2')
399
408
        self.assertEqual(branch.revision_history(), branch2.revision_history())
400
409
        rev2 = branch2.repository.get_revision(self._baz._import_symlink_bzr)
413
422
        self.assertEqual(entry.kind, 'symlink')
414
423
        self.assertEqual(entry.symlink_target, 'missing-file-name')
415
424
 
 
425
        # current bzr doesn't handle type changes
 
426
        self.assertRaises(AssertionError, import_version, 'output3',
 
427
                          pybaz.Version(self._baz._import_symlink))
 
428
 
416
429
    def test_missing_ancestor(self):
417
430
        import_version('output', pybaz.Version(self._baz._missing_ancestor))
418
431
        # expected results: