~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_upgrade.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
79
79
        finally:
80
80
            rt.unlock()
81
81
        # check a backup was made:
 
82
        backup_dir = 'backup.bzr.~1~'
82
83
        transport = get_transport(b.base)
83
 
        transport.stat('backup.bzr')
84
 
        transport.stat('backup.bzr/README')
85
 
        transport.stat('backup.bzr/branch-format')
86
 
        transport.stat('backup.bzr/revision-history')
87
 
        transport.stat('backup.bzr/merged-patches')
88
 
        transport.stat('backup.bzr/pending-merged-patches')
89
 
        transport.stat('backup.bzr/pending-merges')
90
 
        transport.stat('backup.bzr/branch-name')
91
 
        transport.stat('backup.bzr/branch-lock')
92
 
        transport.stat('backup.bzr/inventory')
93
 
        transport.stat('backup.bzr/stat-cache')
94
 
        transport.stat('backup.bzr/text-store')
95
 
        transport.stat('backup.bzr/text-store/foo-20051004035611-1591048e9dc7c2d4.gz')
96
 
        transport.stat('backup.bzr/text-store/foo-20051004035756-4081373d897c3453.gz')
97
 
        transport.stat('backup.bzr/inventory-store/')
98
 
        transport.stat('backup.bzr/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
99
 
        transport.stat('backup.bzr/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
100
 
        transport.stat('backup.bzr/revision-store/')
101
 
        transport.stat('backup.bzr/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
102
 
        transport.stat('backup.bzr/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
 
84
        transport.stat(backup_dir)
 
85
        transport.stat(backup_dir + '/README')
 
86
        transport.stat(backup_dir + '/branch-format')
 
87
        transport.stat(backup_dir + '/revision-history')
 
88
        transport.stat(backup_dir + '/merged-patches')
 
89
        transport.stat(backup_dir + '/pending-merged-patches')
 
90
        transport.stat(backup_dir + '/pending-merges')
 
91
        transport.stat(backup_dir + '/branch-name')
 
92
        transport.stat(backup_dir + '/branch-lock')
 
93
        transport.stat(backup_dir + '/inventory')
 
94
        transport.stat(backup_dir + '/stat-cache')
 
95
        transport.stat(backup_dir + '/text-store')
 
96
        transport.stat(backup_dir + '/text-store/foo-20051004035611-1591048e9dc7c2d4.gz')
 
97
        transport.stat(backup_dir + '/text-store/foo-20051004035756-4081373d897c3453.gz')
 
98
        transport.stat(backup_dir + '/inventory-store/')
 
99
        transport.stat(backup_dir + '/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
 
100
        transport.stat(backup_dir + '/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
 
101
        transport.stat(backup_dir + '/revision-store/')
 
102
        transport.stat(backup_dir + '/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
 
103
        transport.stat(backup_dir + '/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
103
104
 
104
105
    def test_upgrade_with_ghosts(self):
105
106
        """Upgrade v0.0.4 tree containing ghost references.
157
158
        self.assertFalse(transport.has('.bzr/stat-cache'))
158
159
        # XXX: upgrade fails if a backup.bzr is already present
159
160
        # -- David Allouche 2006-08-11
160
 
        transport.delete_tree('backup.bzr')
 
161
        transport.delete_tree('backup.bzr.~1~')
161
162
        # At this point, we have a format6 branch without checkout files.
162
163
        upgrade('.', bzrdir.BzrDirMetaFormat1())
163
164
        # The upgrade should not have set up a working tree.
185
186
        branch.set_push_location('file:///IJ')
186
187
        target = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
187
188
        converter = branch.bzrdir._format.get_converter(target)
188
 
        converter.convert(branch.bzrdir, progress.DummyProgress())
 
189
        converter.convert(branch.bzrdir, None)
189
190
        new_branch = _mod_branch.Branch.open(self.get_url('branch'))
190
191
        self.assertIs(new_branch.__class__, _mod_branch.BzrBranch6)
191
192
        self.assertEqual('CD', new_branch.last_revision())
197
198
 
198
199
        branch2 = self.make_branch('branch2', format='knit')
199
200
        converter = branch2.bzrdir._format.get_converter(target)
200
 
        converter.convert(branch2.bzrdir, progress.DummyProgress())
 
201
        converter.convert(branch2.bzrdir, None)
201
202
        branch2 = _mod_branch.Branch.open(self.get_url('branch'))
202
203
        self.assertIs(branch2.__class__, _mod_branch.BzrBranch6)
203
204
 
206
207
        target = bzrdir.format_registry.make_bzrdir('1.9')
207
208
        target.set_branch_format(_mod_branch.BzrBranchFormat8())
208
209
        converter = branch.bzrdir._format.get_converter(target)
209
 
        converter.convert(branch.bzrdir, progress.DummyProgress())
 
210
        converter.convert(branch.bzrdir, None)
210
211
        branch = _mod_branch.Branch.open(self.get_url('branch'))
211
212
        self.assertIs(branch.__class__, _mod_branch.BzrBranch8)
212
213
        self.assertEqual({}, branch._get_all_reference_info())
216
217
        tree = self.make_branch_and_tree('tree', format='knit')
217
218
        target = bzrdir.format_registry.make_bzrdir('dirstate')
218
219
        converter = tree.bzrdir._format.get_converter(target)
219
 
        converter.convert(tree.bzrdir, progress.DummyProgress())
 
220
        converter.convert(tree.bzrdir, None)
220
221
        new_tree = workingtree.WorkingTree.open('tree')
221
222
        self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
222
223
        self.assertEqual('null:', new_tree.last_revision())
229
230
        tree.add(['file'], ['file-id'])
230
231
        target = bzrdir.format_registry.make_bzrdir('dirstate')
231
232
        converter = tree.bzrdir._format.get_converter(target)
232
 
        converter.convert(tree.bzrdir, progress.DummyProgress())
 
233
        converter.convert(tree.bzrdir, None)
233
234
        new_tree = workingtree.WorkingTree.open('tree')
234
235
        self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
235
236
        self.assertEqual('null:', new_tree.last_revision())
240
241
        rev_id = tree.commit('first post')
241
242
        target = bzrdir.format_registry.make_bzrdir('dirstate')
242
243
        converter = tree.bzrdir._format.get_converter(target)
243
 
        converter.convert(tree.bzrdir, progress.DummyProgress())
 
244
        converter.convert(tree.bzrdir, None)
244
245
        new_tree = workingtree.WorkingTree.open('tree')
245
246
        self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
246
247
        self.assertEqual(rev_id, new_tree.last_revision())
257
258
        tree.merge_from_branch(merge_tree.branch)
258
259
        target = bzrdir.format_registry.make_bzrdir('dirstate')
259
260
        converter = tree.bzrdir._format.get_converter(target)
260
 
        converter.convert(tree.bzrdir, progress.DummyProgress())
 
261
        converter.convert(tree.bzrdir, None)
261
262
        new_tree = workingtree.WorkingTree.open('tree')
262
263
        self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
263
264
        self.assertEqual(rev_id2, new_tree.last_revision())