~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: 2007-08-17 17:49:34 UTC
  • mfrom: (2520.6.5 bundle-fix)
  • Revision ID: pqm@pqm.ubuntu.com-20070817174934-5094ol577uv7ys4u
Fix bundle installation wrong-versionedfile bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
1063
1063
                              " slashes")
1064
1064
        bundle = self.get_valid_bundle('null:', 'rev/id')
1065
1065
 
 
1066
    def test_skip_file(self):
 
1067
        """Make sure we don't accidentally write to the wrong versionedfile"""
 
1068
        self.tree1 = self.make_branch_and_tree('tree')
 
1069
        self.b1 = self.tree1.branch
 
1070
        # rev1 is not present in bundle, done by fetch
 
1071
        self.build_tree_contents([('tree/file2', 'contents1')])
 
1072
        self.tree1.add('file2', 'file2-id')
 
1073
        self.tree1.commit('rev1', rev_id='reva')
 
1074
        self.build_tree_contents([('tree/file3', 'contents2')])
 
1075
        # rev2 is present in bundle, and done by fetch
 
1076
        # having file1 in the bunle causes file1's versionedfile to be opened.
 
1077
        self.tree1.add('file3', 'file3-id')
 
1078
        self.tree1.commit('rev2')
 
1079
        # Updating file2 should not cause an attempt to add to file1's vf
 
1080
        target = self.tree1.bzrdir.sprout('target').open_workingtree()
 
1081
        self.build_tree_contents([('tree/file2', 'contents3')])
 
1082
        self.tree1.commit('rev3', rev_id='rev3')
 
1083
        bundle = self.get_valid_bundle('reva', 'rev3')
 
1084
        if getattr(bundle, 'get_bundle_reader', None) is None:
 
1085
            raise TestSkipped('Bundle format cannot provide reader')
 
1086
        # be sure that file1 comes before file2
 
1087
        for b, m, k, r, f in bundle.get_bundle_reader().iter_records():
 
1088
            if f == 'file3-id':
 
1089
                break
 
1090
            self.assertNotEqual(f, 'file2-id')
 
1091
        bundle.install_revisions(target.branch.repository)
 
1092
 
1066
1093
 
1067
1094
class V08BundleTester(BundleTester, TestCaseWithTransport):
1068
1095