~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Robert Collins
  • Date: 2005-08-23 06:44:54 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050823064454-830ef7d426be03f6
move log and temp dir setup foo into the TestSuite we use

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.branch import Branch
27
27
 
28
28
 
29
 
class TestVersioning(InTempDir):
30
 
    
31
 
    def test_mkdir(self): 
 
29
class Mkdir(InTempDir):
 
30
    def runTest(self): 
32
31
        """Basic 'bzr mkdir' operation"""
33
32
        from bzrlib.commands import run_bzr
34
33
 
50
49
        self.assertEquals(delta.added[0][0], 'foo')
51
50
        self.failIf(delta.modified)
52
51
 
53
 
    def test_add_in_unversioned(self):
 
52
 
 
53
 
 
54
class AddInUnversioned(InTempDir):
 
55
    def runTest(self):
54
56
        """Try to add a file in an unversioned directory.
55
57
 
56
58
        smart_add may eventually add the parent as necessary, but simple
68
70
                          b.add,
69
71
                          'foo/hello')
70
72
        
71
 
    def test_subdir_add(self):
72
 
        """Add in subdirectory should add only things from there down"""
73
 
        
74
 
        from bzrlib.branch import Branch
75
 
        from bzrlib.commands import run_bzr
76
 
        
77
 
        eq = self.assertEqual
78
 
        ass = self.assert_
79
 
        chdir = os.chdir
80
 
        
81
 
        b = Branch('.', init=True)
82
 
        self.build_tree(['src/', 'README'])
83
 
        
84
 
        eq(sorted(b.unknowns()),
85
 
           ['README', 'src'])
86
 
        
87
 
        eq(run_bzr(['add', 'src']), 0)
88
 
        
89
 
        self.build_tree(['src/foo.c'])
90
 
        
91
 
        chdir('src')
92
 
        eq(run_bzr(['add']), 0)
93
 
        
94
 
        eq(sorted(b.unknowns()), 
95
 
           ['README'])
96
 
        eq(len(b.inventory), 3)
97
 
                
98
 
        chdir('..')
99
 
        eq(run_bzr(['add']), 0)
100
 
        eq(list(b.unknowns()), [])
101
 
        
102
73
        
103
74
class SubdirCommit(BzrTestBase):
104
 
 
105
 
    def test_subdir_commit(self):
 
75
    def runTest(self):
106
76
        """Test committing a subdirectory, and committing within a directory."""
107
77
        run_bzr = self.run_bzr
108
78
        eq = self.assertEqual
146
116
        
147
117
        # TODO: factor out some kind of assert_tree_state() method
148
118
        
 
119
        
 
120
        
 
121
class SubdirAdd(InTempDir):
 
122
    def runTest(self):
 
123
        """Add in subdirectory should add only things from there down"""
 
124
        
 
125
        from bzrlib.branch import Branch
 
126
        from bzrlib.commands import run_bzr
 
127
        
 
128
        eq = self.assertEqual
 
129
        ass = self.assert_
 
130
        chdir = os.chdir
 
131
        
 
132
        b = Branch('.', init=True)
 
133
        self.build_tree(['src/', 'README'])
 
134
        
 
135
        eq(sorted(b.unknowns()),
 
136
           ['README', 'src'])
 
137
        
 
138
        eq(run_bzr(['add', 'src']), 0)
 
139
        
 
140
        self.build_tree(['src/foo.c'])
 
141
        
 
142
        chdir('src')
 
143
        eq(run_bzr(['add']), 0)
 
144
        
 
145
        eq(sorted(b.unknowns()), 
 
146
           ['README'])
 
147
        eq(len(b.inventory), 3)
 
148
                
 
149
        chdir('..')
 
150
        eq(run_bzr(['add']), 0)
 
151
        eq(list(b.unknowns()), [])
 
152