~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.bundle.read_bundle import BundleTree, BundleReader
23
23
from bzrlib.bundle.serializer import write_bundle
24
24
from bzrlib.diff import internal_diff
25
 
from bzrlib.errors import BzrError, TestamentMismatch
 
25
from bzrlib.errors import BzrError, TestamentMismatch, NotABundle
26
26
from bzrlib.merge import Merge3Merger
27
27
from bzrlib.osutils import has_symlinks, sha_file
28
28
from bzrlib.tests import TestCaseInTempDir, TestCase, TestSkipped
364
364
        self.valid_apply_bundle(base_rev_id, bundle)
365
365
        return bundle 
366
366
 
 
367
    def test_non_bundle(self):
 
368
        self.assertRaises(NotABundle, BundleReader, StringIO('#!/bin/sh\n'))
 
369
 
367
370
    def get_checkout(self, rev_id, checkout_dir=None):
368
371
        """Get a new tree, with the specified revision in it.
369
372
        """
659
662
                          verbose=False)
660
663
        self.tree1.commit(u'Merge', rev_id='a@lmod-0-4')
661
664
        bundle = self.get_valid_bundle('a@lmod-0-2a', 'a@lmod-0-4')
 
665
 
 
666
    def test_hide_history(self):
 
667
        import os, sys
 
668
        pjoin = os.path.join
 
669
 
 
670
        self.tree1 = BzrDir.create_standalone_workingtree('b1')
 
671
        self.b1 = self.tree1.branch
 
672
 
 
673
        open(pjoin('b1/one'), 'wb').write('one\n')
 
674
        self.tree1.add('one')
 
675
        self.tree1.commit('add file', rev_id='a@cset-0-1')
 
676
        open(pjoin('b1/one'), 'wb').write('two\n')
 
677
        self.tree1.commit('modify', rev_id='a@cset-0-2')
 
678
        open(pjoin('b1/one'), 'wb').write('three\n')
 
679
        self.tree1.commit('modify', rev_id='a@cset-0-3')
 
680
        bundle_file = StringIO()
 
681
        rev_ids = write_bundle(self.tree1.branch.repository, 'a@cset-0-3',
 
682
                               'a@cset-0-1', bundle_file)
 
683
        self.assertNotContainsRe(bundle_file.getvalue(), 'two')
 
684
        self.assertContainsRe(bundle_file.getvalue(), 'one')
 
685
        self.assertContainsRe(bundle_file.getvalue(), 'three')