~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-11 00:28:34 UTC
  • mfrom: (1793.3.13 bundle-fixes)
  • Revision ID: pqm@pqm.ubuntu.com-20060711002834-437bd17f804929ad
(jam) Updates to bundles, handle binary files, non integer timezone offsets, and sftp pull

Show diffs side-by-side

added added

removed removed

Lines of Context:
610
610
        self.tree1 = BzrDir.create_standalone_workingtree('b1')
611
611
        self.b1 = self.tree1.branch
612
612
        tt = TreeTransform(self.tree1)
613
 
        tt.new_file('file', tt.root, '\x00\xff', 'binary-1')
614
 
        tt.new_file('file2', tt.root, '\x00\xff', 'binary-2')
 
613
        
 
614
        # Add
 
615
        tt.new_file('file', tt.root, '\x00\n\x00\r\x01\n\x02\r\xff', 'binary-1')
 
616
        tt.new_file('file2', tt.root, '\x01\n\x02\r\x03\n\x04\r\xff', 'binary-2')
615
617
        tt.apply()
616
618
        self.tree1.commit('add binary', rev_id='b@cset-0-1')
617
619
        self.get_valid_bundle(None, 'b@cset-0-1')
 
620
 
 
621
        # Delete
618
622
        tt = TreeTransform(self.tree1)
619
623
        trans_id = tt.trans_id_tree_file_id('binary-1')
620
624
        tt.delete_contents(trans_id)
621
625
        tt.apply()
622
626
        self.tree1.commit('delete binary', rev_id='b@cset-0-2')
623
627
        self.get_valid_bundle('b@cset-0-1', 'b@cset-0-2')
 
628
 
 
629
        # Rename & modify
624
630
        tt = TreeTransform(self.tree1)
625
631
        trans_id = tt.trans_id_tree_file_id('binary-2')
626
632
        tt.adjust_path('file3', tt.root, trans_id)
627
633
        tt.delete_contents(trans_id)
628
 
        tt.create_file('filecontents\x00', trans_id)
 
634
        tt.create_file('file\rcontents\x00\n\x00', trans_id)
629
635
        tt.apply()
630
636
        self.tree1.commit('rename and modify binary', rev_id='b@cset-0-3')
631
637
        self.get_valid_bundle('b@cset-0-2', 'b@cset-0-3')
 
638
 
 
639
        # Modify
632
640
        tt = TreeTransform(self.tree1)
633
641
        trans_id = tt.trans_id_tree_file_id('binary-2')
634
642
        tt.delete_contents(trans_id)
635
 
        tt.create_file('\x00filecontents', trans_id)
 
643
        tt.create_file('\x00file\rcontents', trans_id)
636
644
        tt.apply()
637
645
        self.tree1.commit('just modify binary', rev_id='b@cset-0-4')
638
646
        self.get_valid_bundle('b@cset-0-3', 'b@cset-0-4')
639
647
 
 
648
        # Rollup
 
649
        self.get_valid_bundle(None, 'b@cset-0-4')
 
650
 
640
651
    def test_last_modified(self):
641
652
        self.tree1 = BzrDir.create_standalone_workingtree('b1')
642
653
        self.b1 = self.tree1.branch
769
780
        # Now test a complet roll-up
770
781
        bundle = self.get_valid_bundle(None, 'white-4')
771
782
 
 
783
    def test_alt_timezone_bundle(self):
 
784
        self.tree1 = self.make_branch_and_tree('b1')
 
785
        self.b1 = self.tree1.branch
 
786
 
 
787
        self.build_tree(['b1/newfile'])
 
788
        self.tree1.add(['newfile'])
 
789
 
 
790
        # Asia/Colombo offset = 5 hours 30 minutes
 
791
        self.tree1.commit('non-hour offset timezone', rev_id='tz-1',
 
792
                          timezone=19800, timestamp=1152544886.0)
 
793
 
 
794
        bundle = self.get_valid_bundle(None, 'tz-1')
 
795
        
 
796
        rev = bundle.revisions[0]
 
797
        self.assertEqual('Mon 2006-07-10 20:51:26.000000000 +0530', rev.date)
 
798
        self.assertEqual(19800, rev.timezone)
 
799
        self.assertEqual(1152544886.0, rev.timestamp)
 
800
 
772
801
 
773
802
class MungedBundleTester(TestCaseWithTransport):
774
803