~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_baz_import.py

  • Committer: Robert Collins
  • Date: 2005-09-13 14:14:22 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050913141422-e391cb880f6920df
make feedback be callback based - really

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from baz_import import import_version, revision_id, cmd_baz_import
26
26
from bzrlib.branch import find_branch
27
27
import shutil
 
28
from StringIO import StringIO
28
29
import tempfile
29
30
from testresources import (TestResource, TestLoader, OptimisingTestSuite,
30
31
                           ResourcedTestCase)
135
136
    def setUp(self):
136
137
        TestCaseInTempDir.setUp(self)
137
138
        ResourcedTestCase.setUpResources(self)
 
139
        self.output = StringIO()
138
140
 
139
141
    def tearDown(self):
140
142
        ResourcedTestCase.tearDownResources(self)
141
143
        TestCaseInTempDir.tearDown(self)
142
 
        
 
144
 
 
145
    def collect(self, text):
 
146
        self.output.write(text)
 
147
        self.output.write("\n")
 
148
 
143
149
    def test_import_empty(self):
144
 
        import_version('output', pybaz.Version(self._baz._import))
 
150
        import_version('output', pybaz.Version(self._baz._import), self.collect)
145
151
        # expected results:
146
152
        # one commit, no files, revision identifier of 'demo@DONOTUSE_c--import--0--base-0'
147
153
        branch = find_branch('output', find_root=False)
149
155
                         ['Arch-1:demo@DONOTUSE%c--import--0--base-0'])
150
156
        rev = branch.get_revision('Arch-1:demo@DONOTUSE%c--import--0--base-0')
151
157
        # and again.
152
 
        import_version('output2', pybaz.Version('demo@DONOTUSE/c--import--0'))
 
158
        import_version('output2', pybaz.Version('demo@DONOTUSE/c--import--0'),
 
159
                       self.collect)
153
160
        branch2 = find_branch('output2', find_root=False)
154
161
        self.assertEqual(branch.revision_history(), branch2.revision_history())
155
162
        rev2 = branch2.get_revision('Arch-1:demo@DONOTUSE%c--import--0--base-0')
163
170
                         "Arch-1:demo@DONOTUSE%c--import--0--base-0")
164
171
 
165
172
    def test_empty_tagged(self):
166
 
        import_version('output', pybaz.Version(self._baz._empty_tag))
 
173
        import_version('output', pybaz.Version(self._baz._empty_tag),
 
174
                       self.collect)
167
175
        # expected results:
168
176
        # two commits, no files, revision identifiers of 
169
177
        # 'demo@DONOTUSE_c--import--0--base-0' and
174
182
                          self._baz._empty_tag_bzr])
175
183
        rev = branch.get_revision(self._baz._empty_tag_bzr)
176
184
        # and again.
177
 
        import_version('output2', pybaz.Version(self._baz._empty_tag))
 
185
        import_version('output2', pybaz.Version(self._baz._empty_tag),
 
186
                       self.collect)
178
187
        branch2 = find_branch('output2', find_root=False)
179
188
        self.assertEqual(branch.revision_history(), branch2.revision_history())
180
189
        rev2 = branch2.get_revision(self._baz._empty_tag_bzr)
187
196
        self.assertEqual(rev.revision_id, self._baz._empty_tag_bzr)
188
197
 
189
198
    def test_empty_merged_tagged(self):
190
 
        import_version('output', pybaz.Version(self._baz._empty_merged_tag))
 
199
        import_version('output', pybaz.Version(self._baz._empty_merged_tag),
 
200
                       self.collect)
191
201
        # expected results:
192
202
        # two commits, no files, revision identifiers of 
193
203
        # 'demo@DONOTUSE_c--import--0--base-0' and
201
211
                          self._baz._empty_merged_tag_bzr_base,
202
212
                          self._baz._empty_merged_tag_bzr])
203
213
        # and again.
204
 
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag))
 
214
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag),
 
215
                       self.collect)
205
216
        branch2 = find_branch('output2', find_root=False)
206
217
        # and import what we should be merged up against for checking with.
207
 
        import_version('output3', pybaz.Version(self._baz._empty_tag))
 
218
        import_version('output3', pybaz.Version(self._baz._empty_tag),
 
219
                       self.collect)
208
220
        branch3 = find_branch('output3', find_root=False)
209
221
        
210
222
        self.assertEqual(branch.revision_history(), branch2.revision_history())
238
250
        # self.assertEqual(branch.missing_revisions(branch3), [])
239
251
        
240
252
    def test_merge_branch_with_merges(self):
241
 
        import_version('output', pybaz.Version(self._baz._empty_merged_tag_2))
 
253
        import_version('output', pybaz.Version(self._baz._empty_merged_tag_2),
 
254
                       self.collect)
242
255
        # expected results:
243
256
        # two commits, no files, revision identifiers of 
244
257
        # 'demo@DONOTUSE_c--import--0--base-0' and
252
265
                          self._baz._empty_merged_tag_2_bzr_base,
253
266
                          self._baz._empty_merged_tag_2_bzr])
254
267
        # and again.
255
 
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag_2))
 
268
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag_2),
 
269
                       self.collect)
256
270
        branch2 = find_branch('output2', find_root=False)
257
271
        # and import what we should be merged up against for checking with.
258
 
        import_version('output3', pybaz.Version(self._baz._empty_merged_tag))
 
272
        import_version('output3', pybaz.Version(self._baz._empty_merged_tag),
 
273
                       self.collect)
259
274
        branch3 = find_branch('output3', find_root=False)
260
275
        
261
276
        self.assertEqual(branch.revision_history(), branch2.revision_history())
289
304
        # self.assertEqual(branch.missing_revisions(branch3), [])
290
305
        
291
306
    def test_import_symlink(self):
292
 
        import_version('output', pybaz.Version(self._baz._import_symlink))
 
307
        import_version('output', pybaz.Version(self._baz._import_symlink),
 
308
                       self.collect)
293
309
        # expected results:
294
310
        # one commit, no files, revision identifier of 'demo@DONOTUSE_c--import--0--base-0'
295
311
        branch = find_branch('output', find_root=False)
297
313
                         [self._baz._import_symlink_bzr])
298
314
        rev = branch.get_revision(self._baz._import_symlink_bzr)
299
315
        # and again.
300
 
        import_version('output2', pybaz.Version(self._baz._import_symlink))
 
316
        import_version('output2', pybaz.Version(self._baz._import_symlink),
 
317
                       self.collect)
301
318
        branch2 = find_branch('output2', find_root=False)
302
319
        self.assertEqual(branch.revision_history(), branch2.revision_history())
303
320
        rev2 = branch2.get_revision(self._baz._import_symlink_bzr)