~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Aaron Bentley
  • Date: 2005-10-04 04:32:32 UTC
  • mfrom: (1185.12.6)
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051004043231-40302a149769263b
merged my own changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    
35
35
    def test_mkdir(self): 
36
36
        """Basic 'bzr mkdir' operation"""
 
37
        from bzrlib.commands import run_bzr
37
38
 
38
 
        self.run_bzr('init')
39
 
        self.run_bzr('mkdir', 'foo')
 
39
        run_bzr(['init'])
 
40
        run_bzr(['mkdir', 'foo'])
40
41
        self.assert_(os.path.isdir('foo'))
41
42
 
42
 
        self.run_bzr('mkdir', 'foo', retcode=2)
 
43
        self.assertRaises(OSError, run_bzr, ['mkdir', 'foo'])
43
44
 
44
45
        from bzrlib.diff import compare_trees
45
46
        from bzrlib.branch import Branch
73
74
        
74
75
        self.check_branch()
75
76
 
 
77
 
76
78
    def test_add_in_unversioned(self):
77
79
        """Try to add a file in an unversioned directory.
78
80
 
79
81
        "bzr add" should add the parent(s) as necessary.
80
82
        """
81
83
        from bzrlib.branch import Branch
 
84
        from bzrlib.commands import run_bzr
82
85
        eq = self.assertEqual
83
86
 
84
87
        b = Branch.initialize('.')
85
88
 
86
89
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
87
90
        eq(list(b.unknowns()), ['inertiatic'])
88
 
        self.run_bzr('add', 'inertiatic/esp')
 
91
        run_bzr(['add', 'inertiatic/esp'])
89
92
        eq(list(b.unknowns()), [])
90
93
 
91
94
        # Multiple unversioned parents
92
95
        self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
93
96
        eq(list(b.unknowns()), ['veil'])
94
 
        self.run_bzr('add', 'veil/cerpin/taxt')
 
97
        run_bzr(['add', 'veil/cerpin/taxt'])
95
98
        eq(list(b.unknowns()), [])
96
99
 
97
100
        # Check whacky paths work
98
101
        self.build_tree(['cicatriz/', 'cicatriz/esp'])
99
102
        eq(list(b.unknowns()), ['cicatriz'])
100
 
        self.run_bzr('add', 'inertiatic/../cicatriz/esp')
 
103
        run_bzr(['add', 'inertiatic/../cicatriz/esp'])
101
104
        eq(list(b.unknowns()), [])
102
105
 
103
106
    def test_add_in_versioned(self):
106
109
        "bzr add" should do this happily.
107
110
        """
108
111
        from bzrlib.branch import Branch
 
112
        from bzrlib.commands import run_bzr
109
113
        eq = self.assertEqual
110
114
 
111
115
        b = Branch.initialize('.')
112
116
 
113
117
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
114
118
        eq(list(b.unknowns()), ['inertiatic'])
115
 
        self.run_bzr('add', '--no-recurse', 'inertiatic')
 
119
        run_bzr(['add', '--no-recurse', 'inertiatic'])
116
120
        eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
117
 
        self.run_bzr('add', 'inertiatic/esp')
 
121
        run_bzr(['add', 'inertiatic/esp'])
118
122
        eq(list(b.unknowns()), [])
119
123
 
120
124
    def test_subdir_add(self):
121
125
        """Add in subdirectory should add only things from there down"""
122
126
        
123
127
        from bzrlib.branch import Branch
 
128
        from bzrlib.commands import run_bzr
124
129
        
125
130
        eq = self.assertEqual
126
131
        ass = self.assert_
132
137
        eq(sorted(b.unknowns()),
133
138
           ['README', 'src'])
134
139
        
135
 
        self.run_bzr('add', 'src')
 
140
        eq(run_bzr(['add', 'src']), 0)
136
141
        
137
142
        self.build_tree(['src/foo.c'])
138
143
        
139
144
        chdir('src')
140
 
        self.run_bzr('add')
 
145
        eq(run_bzr(['add']), 0)
141
146
        
142
147
        eq(sorted(b.unknowns()), 
143
148
           ['README'])
144
149
        eq(len(b.inventory), 3)
145
150
                
146
151
        chdir('..')
147
 
        self.run_bzr('add')
 
152
        eq(run_bzr(['add']), 0)
148
153
        eq(list(b.unknowns()), [])
149
154
 
150
155
        self.check_branch()
151
156
 
 
157
 
152
158
    def check_branch(self):
153
159
        """After all the above changes, run the check and upgrade commands.
154
160
 
158
164
        
159
165
        debug('check branch...')
160
166
        from bzrlib.check import check
161
 
        check(b, False)
 
167
        check(b)
162
168
        
163
169
 
164
170