~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2004-2006 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
38
38
from bzrlib.errors import (BzrError, TestamentMismatch, NotABundle, BadBundle, 
39
39
                           NoSuchFile,)
40
40
from bzrlib.merge import Merge3Merger
41
 
from bzrlib.repofmt import knitrepo
42
41
from bzrlib.osutils import has_symlinks, sha_file
43
42
from bzrlib.tests import (TestCaseInTempDir, TestCaseWithTransport,
44
43
                          TestCase, TestSkipped)
314
313
 
315
314
    def test_mismatched_bundle(self):
316
315
        format = bzrdir.BzrDirMetaFormat1()
317
 
        format.repository_format = knitrepo.RepositoryFormatKnit3()
 
316
        format.repository_format = repository.RepositoryFormatKnit2()
318
317
        serializer = BundleSerializerV08('0.8')
319
318
        b = self.make_branch('.', format=format)
320
 
        self.assertRaises(errors.IncompatibleBundleFormat, serializer.write, 
 
319
        self.assertRaises(errors.IncompatibleFormat, serializer.write, 
321
320
                          b.repository, [], {}, StringIO())
322
321
 
323
322
    def test_matched_bundle(self):
324
 
        """Don't raise IncompatibleBundleFormat for knit2 and bundle0.9"""
 
323
        """Don't raise IncompatibleFormat for knit2 and bundle0.9"""
325
324
        format = bzrdir.BzrDirMetaFormat1()
326
 
        format.repository_format = knitrepo.RepositoryFormatKnit3()
 
325
        format.repository_format = repository.RepositoryFormatKnit2()
327
326
        serializer = BundleSerializerV09('0.9')
328
327
        b = self.make_branch('.', format=format)
329
328
        serializer.write(b.repository, [], {}, StringIO())
331
330
    def test_mismatched_model(self):
332
331
        """Try copying a bundle from knit2 to knit1"""
333
332
        format = bzrdir.BzrDirMetaFormat1()
334
 
        format.repository_format = knitrepo.RepositoryFormatKnit3()
 
333
        format.repository_format = repository.RepositoryFormatKnit2()
335
334
        source = self.make_branch_and_tree('source', format=format)
336
335
        source.commit('one', rev_id='one-id')
337
336
        source.commit('two', rev_id='two-id')
341
340
        text.seek(0)
342
341
 
343
342
        format = bzrdir.BzrDirMetaFormat1()
344
 
        format.repository_format = knitrepo.RepositoryFormatKnit1()
 
343
        format.repository_format = repository.RepositoryFormatKnit1()
345
344
        target = self.make_branch('target', format=format)
346
345
        self.assertRaises(errors.IncompatibleRevision, install_bundle, 
347
346
                          target.repository, read_bundle(text))
353
352
 
354
353
    def bzrdir_format(self):
355
354
        format = bzrdir.BzrDirMetaFormat1()
356
 
        format.repository_format = knitrepo.RepositoryFormatKnit1()
 
355
        format.repository_format = repository.RepositoryFormatKnit1()
357
356
        return format
358
357
 
359
358
    def make_branch_and_tree(self, path, format=None):
488
487
            tree.update()
489
488
            delta = tree.changes_from(self.b1.repository.revision_tree(rev_id))
490
489
            self.assertFalse(delta.has_changed(),
491
 
                             'Working tree has modifications: %s' % delta)
 
490
                             'Working tree has modifications')
492
491
        return tree
493
492
 
494
493
    def valid_apply_bundle(self, base_rev_id, info, checkout_dir=None):
891
890
 
892
891
    def bzrdir_format(self):
893
892
        format = bzrdir.BzrDirMetaFormat1()
894
 
        format.repository_format = knitrepo.RepositoryFormatKnit3()
 
893
        format.repository_format = repository.RepositoryFormatKnit2()
895
894
        return format
896
895
 
897
896
 
901
900
 
902
901
    def bzrdir_format(self):
903
902
        format = bzrdir.BzrDirMetaFormat1()
904
 
        format.repository_format = knitrepo.RepositoryFormatKnit1()
 
903
        format.repository_format = repository.RepositoryFormatKnit1()
905
904
        return format
906
905
 
907
906