~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-28 06:11:50 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-20050928061150-2920dac61286de9f
update to latest bzr api

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    pybaz = None
24
24
import os
25
25
from baz_import import import_version, revision_id, cmd_baz_import
26
 
from bzrlib.branch import find_branch
27
26
from bzrlib.errors import NoSuchRevision
28
27
import shutil
29
28
from StringIO import StringIO
31
30
from testresources import (TestResource, TestLoader, OptimisingTestSuite,
32
31
                           ResourcedTestCase)
33
32
from fai import namespace_previous
 
33
from bzrlib.branch import Branch
34
34
 
35
35
def test_suite():
36
36
    if pybaz is None:
175
175
        import_version('output', pybaz.Version(self._baz._import), self.collect)
176
176
        # expected results:
177
177
        # one commit, no files, revision identifier of 'demo@DONOTUSE_c--import--0--base-0'
178
 
        branch = find_branch('output', find_root=False)
 
178
        branch = Branch.open('output')
179
179
        self.assertEqual(branch.revision_history(),
180
180
                         ['Arch-1:demo@DONOTUSE%c--import--0--base-0'])
181
181
        rev = branch.get_revision('Arch-1:demo@DONOTUSE%c--import--0--base-0')
182
182
        # and again.
183
183
        import_version('output2', pybaz.Version('demo@DONOTUSE/c--import--0'),
184
184
                       self.collect)
185
 
        branch2 = find_branch('output2', find_root=False)
 
185
        branch2 = Branch.open('output2')
186
186
        self.assertEqual(branch.revision_history(), branch2.revision_history())
187
187
        rev2 = branch2.get_revision('Arch-1:demo@DONOTUSE%c--import--0--base-0')
188
188
        # they must be the same
201
201
        # two commits, no files, revision identifiers of 
202
202
        # 'demo@DONOTUSE_c--import--0--base-0' and
203
203
        # self._baz._empty_tag_bzr
204
 
        branch = find_branch('output', find_root=False)
 
204
        branch = Branch.open('output')
205
205
        self.assertEqual(branch.revision_history(),
206
206
                         ['Arch-1:demo@DONOTUSE%c--import--0--base-0',
207
207
                          self._baz._empty_tag_bzr])
209
209
        # and again.
210
210
        import_version('output2', pybaz.Version(self._baz._empty_tag),
211
211
                       self.collect)
212
 
        branch2 = find_branch('output2', find_root=False)
 
212
        branch2 = Branch.open('output2')
213
213
        self.assertEqual(branch.revision_history(), branch2.revision_history())
214
214
        rev2 = branch2.get_revision(self._baz._empty_tag_bzr)
215
215
        # they must be the same
230
230
        # self._baz._empty_merged_tag_bzr
231
231
        # and a merged revision from the latter of
232
232
        # self._baz._empty_tag_bzr
233
 
        branch = find_branch('output', find_root=False)
 
233
        branch = Branch.open('output')
234
234
        self.assertEqual(branch.revision_history(),
235
235
                         ['Arch-1:demo@DONOTUSE%c--import--0--base-0',
236
236
                          self._baz._empty_merged_tag_bzr_base,
238
238
        # and again.
239
239
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag),
240
240
                       self.collect)
241
 
        branch2 = find_branch('output2', find_root=False)
 
241
        branch2 = Branch.open('output2')
242
242
        # and import what we should be merged up against for checking with.
243
243
        import_version('output3', pybaz.Version(self._baz._empty_tag),
244
244
                       self.collect)
245
 
        branch3 = find_branch('output3', find_root=False)
 
245
        branch3 = Branch.open('output3')
246
246
        
247
247
        self.assertEqual(branch.revision_history(), branch2.revision_history())
248
248
        self.assertNotEqual(branch.revision_history(), branch3.revision_history())
284
284
        # self._baz._empty_merged_tag_2_bzr
285
285
        # and a merged revision from the latter of
286
286
        # self._baz._empty_merged_tag_bzr
287
 
        branch = find_branch('output', find_root=False)
 
287
        branch = Branch.open('output')
288
288
        self.assertEqual(branch.revision_history(),
289
289
                         ['Arch-1:demo@DONOTUSE%c--import--0--base-0',
290
290
                          self._baz._empty_merged_tag_2_bzr_base,
292
292
        # and again.
293
293
        import_version('output2', pybaz.Version(self._baz._empty_merged_tag_2),
294
294
                       self.collect)
295
 
        branch2 = find_branch('output2', find_root=False)
 
295
        branch2 = Branch.open('output2')
296
296
        # and import what we should be merged up against for checking with.
297
297
        import_version('output3', pybaz.Version(self._baz._empty_merged_tag),
298
298
                       self.collect)
299
 
        branch3 = find_branch('output3', find_root=False)
 
299
        branch3 = Branch.open('output3')
300
300
        
301
301
        self.assertEqual(branch.revision_history(), branch2.revision_history())
302
302
        self.assertNotEqual(branch.revision_history(), branch3.revision_history())
333
333
                       self.collect)
334
334
        # expected results:
335
335
        # one commit, no files, revision identifier of 'demo@DONOTUSE_c--import--0--base-0'
336
 
        branch = find_branch('output', find_root=False)
 
336
        branch = Branch.open('output')
337
337
        self.assertEqual(branch.revision_history(),
338
338
                         [self._baz._import_symlink_bzr])
339
339
        rev = branch.get_revision(self._baz._import_symlink_bzr)
340
340
        # and again.
341
341
        import_version('output2', pybaz.Version(self._baz._import_symlink),
342
342
                       self.collect)
343
 
        branch2 = find_branch('output2', find_root=False)
 
343
        branch2 = Branch.open('output2')
344
344
        self.assertEqual(branch.revision_history(), branch2.revision_history())
345
345
        rev2 = branch2.get_revision(self._baz._import_symlink_bzr)
346
346
        # they must be the same
365
365
        # one commits, no files, revision identifiers of 
366
366
        # 'demo@DONOTUSE_c--gone--0--base-0' and
367
367
        # a merge of demo-gone@DONOTUSE%c--import--0
368
 
        branch = find_branch('output', find_root=False)
 
368
        branch = Branch.open('output')
369
369
        self.assertEqual(branch.revision_history(),
370
370
                         [self._baz._missing_ancestor_bzr])
371
371
        rev = branch.get_revision(self._baz._missing_ancestor_bzr)
372
372
        # and again.
373
373
        import_version('output2', pybaz.Version(self._baz._missing_ancestor),
374
374
                       self.collect)
375
 
        branch2 = find_branch('output2', find_root=False)
 
375
        branch2 = Branch.open('output2')
376
376
        self.assertEqual(branch.revision_history(), branch2.revision_history())
377
377
        rev2 = branch2.get_revision(self._baz._missing_ancestor_bzr)
378
378
        # they must be the same
413
413
                          self.version['version-0'])
414
414
 
415
415
    def test_version1_version0(self):
416
 
        self.assertEqual(namespace_previous(self.version['version-1']),
 
416
        self.assertEqual(namespace_previous(self.version['versionfix-1']),
417
417
                         self.version['version-0'])
418
418
 
419
419
    def test_version3000_patch2999(self):
420
 
        self.assertEqual(namespace_previous(self.version['version-3000']),
421
 
                         self.version['version-2999'])
 
420
        self.assertEqual(namespace_previous(self.version['versionfix-3000']),
 
421
                         self.version['versionfix-2999'])
422
422
 
423
423
class TestNamespaceMapping(TestCase):
424
424