~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2007-02-13 20:33:57 UTC
  • mfrom: (2283 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2294.
  • Revision ID: john@arbash-meinel.com-20070213203357-b7yg41mi9sk6cqd0
[merge] bzr.dev 2283
resolve conflicts in moved repository formats
small issue with osutils.contains_whitespace()

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    errors,
23
23
    lockdir,
 
24
    osutils,
 
25
    tests,
24
26
    )
25
27
from bzrlib.branch import Branch
26
28
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
552
554
        timestamp_1ms = round(timestamp, 3)
553
555
        self.assertEqual(timestamp_1ms, timestamp)
554
556
 
 
557
    def test_commit_kind_changes(self):
 
558
        if not osutils.has_symlinks():
 
559
            raise tests.TestSkipped('Test requires symlink support')
 
560
        tree = self.make_branch_and_tree('.')
 
561
        os.symlink('target', 'name')
 
562
        tree.add('name', 'a-file-id')
 
563
        tree.commit('Added a symlink')
 
564
        self.assertEqual('symlink', tree.basis_tree().kind('a-file-id'))
 
565
 
 
566
        os.unlink('name')
 
567
        self.build_tree(['name'])
 
568
        tree.commit('Changed symlink to file')
 
569
        self.assertEqual('file', tree.basis_tree().kind('a-file-id'))
 
570
 
 
571
        os.unlink('name')
 
572
        os.symlink('target', 'name')
 
573
        tree.commit('file to symlink')
 
574
        self.assertEqual('symlink', tree.basis_tree().kind('a-file-id'))
 
575
 
 
576
        os.unlink('name')
 
577
        os.mkdir('name')
 
578
        tree.commit('symlink to directory')
 
579
        self.assertEqual('directory', tree.basis_tree().kind('a-file-id'))
 
580
 
 
581
        os.rmdir('name')
 
582
        os.symlink('target', 'name')
 
583
        tree.commit('directory to symlink')
 
584
        self.assertEqual('symlink', tree.basis_tree().kind('a-file-id'))
 
585
 
 
586
        # prepare for directory <-> file tests
 
587
        os.unlink('name')
 
588
        os.mkdir('name')
 
589
        tree.commit('symlink to directory')
 
590
        self.assertEqual('directory', tree.basis_tree().kind('a-file-id'))
 
591
 
 
592
        os.rmdir('name')
 
593
        self.build_tree(['name'])
 
594
        tree.commit('Changed directory to file')
 
595
        self.assertEqual('file', tree.basis_tree().kind('a-file-id'))
 
596
 
 
597
        os.unlink('name')
 
598
        os.mkdir('name')
 
599
        tree.commit('file to directory')
 
600
        self.assertEqual('directory', tree.basis_tree().kind('a-file-id'))
 
601
 
555
602
    def test_commit_unversioned_specified(self):
556
603
        """Commit should raise if specified files isn't in basis or worktree"""
557
604
        tree = self.make_branch_and_tree('.')