~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_upgrade.py

  • Committer: Martin Pool
  • Date: 2005-10-04 06:44:50 UTC
  • mto: (1185.13.3)
  • mto: This revision was merged to the branch mainline in revision 1403.
  • Revision ID: mbp@sourcefrog.net-20051004064450-6437da8f84d41517
- add test that upgrade completes successfully

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
    def test_upgrade_simple(self):
80
80
        """Upgrade simple v0.0.4 format to v5"""
 
81
        eq = self.assertEquals
81
82
        build_tree_contents(_upgrade1_template)
82
83
        upgrade('.')
83
84
        b = Branch.open('.')
 
85
        eq(b._branch_format, 5)
 
86
        rh = b.revision_history()
 
87
        eq(rh,
 
88
           ['mbp@sourcefrog.net-20051004035611-176b16534b086b3c',
 
89
            'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd'])
 
90
        t = b.revision_tree(rh[0])
 
91
        foo_id = 'foo-20051004035605-91e788d1875603ae'
 
92
        eq(t.get_file_text(foo_id), 'initial contents\n')
 
93
        t = b.revision_tree(rh[1])
 
94
        eq(t.get_file_text(foo_id), 'new contents\n')
84
95
 
85
96
 
86
97
_upgrade1_template = \
91
102
  'This is a Bazaar-NG control directory.\nDo not change any files in this directory.\n'),
92
103
 ('.bzr/branch-format', 'Bazaar-NG branch, format 0.0.4\n'),
93
104
 ('.bzr/revision-history',
94
 
  'mbp@sourcefrog.net-20051004035611-176b16534b086b3c\nmbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd\n'),
 
105
  'mbp@sourcefrog.net-20051004035611-176b16534b086b3c\n'
 
106
  'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd\n'),
95
107
 ('.bzr/merged-patches', ''),
96
108
 ('.bzr/pending-merged-patches', ''),
97
109
 ('.bzr/branch-name', ''),
98
110
 ('.bzr/branch-lock', ''),
99
111
 ('.bzr/pending-merges', ''),
100
112
 ('.bzr/inventory',
101
 
  '<inventory>\n<entry file_id="foo-20051004035605-91e788d1875603ae" kind="file" name="foo" />\n</inventory>\n'),
 
113
  '<inventory>\n'
 
114
  '<entry file_id="foo-20051004035605-91e788d1875603ae" kind="file" name="foo" />\n'
 
115
  '</inventory>\n'),
102
116
 ('.bzr/stat-cache',
103
 
  '### bzr hashcache v5\nfoo// be9f309239729f69a6309e970ef24941d31e042c 13 1128398176 1128398176 303464 770\n'),
 
117
  '### bzr hashcache v5\n'
 
118
  'foo// be9f309239729f69a6309e970ef24941d31e042c 13 1128398176 1128398176 303464 770\n'),
104
119
 ('.bzr/text-store/',),
105
120
 ('.bzr/text-store/foo-20051004035611-1591048e9dc7c2d4.gz',
106
121
  '\x1f\x8b\x08\x00[\xfdAC\x02\xff\xcb\xcc\xcb,\xc9L\xccQH\xce\xcf+I\xcd+)\xe6\x02\x00\xdd\xcc\xf90\x11\x00\x00\x00'),