~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-07-02 03:36:18 UTC
  • mto: (1711.4.39 win32-accepted)
  • mto: This revision was merged to the branch mainline in revision 1836.
  • Revision ID: john@arbash-meinel.com-20060702033618-8e8d68c805f04abe
Include a test to ensure bundles handle trailing whitespace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from cStringIO import StringIO
18
18
import os
 
19
import sys
19
20
import tempfile
20
21
 
21
22
from bzrlib.builtins import merge
297
298
        self.assertEqual(self.sorted_ids(btree), ['a', 'b', 'd', 'e'])
298
299
 
299
300
 
300
 
class BundleTester(TestCaseInTempDir):
 
301
class BundleTester(TestCaseWithTransport):
301
302
 
302
303
    def create_bundle_text(self, base_rev_id, rev_id):
303
304
        bundle_txt = StringIO()
473
474
            #         to_tree.get_file(fileid).read())
474
475
 
475
476
    def test_bundle(self):
476
 
        self.tree1 = BzrDir.create_standalone_workingtree('b1')
 
477
        self.tree1 = self.make_branch_and_tree('b1')
477
478
        self.b1 = self.tree1.branch
478
479
 
479
480
        open('b1/one', 'wb').write('one\n')
499
500
                , 'b1/sub/'
500
501
                , 'b1/sub/sub/'
501
502
                , 'b1/sub/sub/nonempty.txt'
502
 
                # Tabs are not valid in filenames on windows
503
 
                #'b1/with\ttab.txt'
504
503
                ])
505
504
        open('b1/sub/sub/emptyfile.txt', 'wb').close()
506
505
        open('b1/dir/nolastnewline.txt', 'wb').write('bloop')
697
696
        self.assertContainsRe(bundle_file.getvalue(), 'one')
698
697
        self.assertContainsRe(bundle_file.getvalue(), 'three')
699
698
 
 
699
    def test_whitespace_bundle(self):
 
700
        if sys.platform in ('win32', 'cygwin'):
 
701
            raise TestSkipped('Windows doesn\'t support filenames'
 
702
                              ' with tabs or trailing spaces')
 
703
        self.tree1 = self.make_branch_and_tree('b1')
 
704
        self.b1 = self.tree1.branch
 
705
 
 
706
        self.build_tree(['b1/trailing space '])
 
707
        self.tree1.add(['trailing space '])
 
708
        # TODO: jam 20060701 Check for handling files with '\t' characters
 
709
        #       once we actually support them
 
710
 
 
711
        # Added
 
712
        self.tree1.commit('funky whitespace', rev_id='white-1')
 
713
 
 
714
        bundle = self.get_valid_bundle(None, 'white-1')
 
715
 
 
716
        # Modified
 
717
        open('b1/trailing space ', 'ab').write('add some text\n')
 
718
        self.tree1.commit('add text', rev_id='white-2')
 
719
 
 
720
        bundle = self.get_valid_bundle('white-1', 'white-2')
 
721
 
 
722
        # Renamed
 
723
        self.tree1.rename_one('trailing space ', ' start and end space ')
 
724
        self.tree1.commit('rename', rev_id='white-3')
 
725
 
 
726
        bundle = self.get_valid_bundle('white-2', 'white-3')
 
727
 
 
728
        # Removed
 
729
        self.tree1.remove([' start and end space '])
 
730
        self.tree1.commit('removed', rev_id='white-4')
 
731
 
 
732
        bundle = self.get_valid_bundle('white-3', 'white-4')
 
733
        
 
734
        # Now test a complet roll-up
 
735
        bundle = self.get_valid_bundle(None, 'white-4')
 
736
 
700
737
 
701
738
class MungedBundleTester(TestCaseWithTransport):
702
739