29
29
from bzrlib.upgrade import upgrade
30
30
from bzrlib.selftest.treeshape import build_tree_contents
32
33
class TestUpgrade(TestCaseInTempDir):
33
35
def test_build_tree(self):
34
36
"""Test tree-building test helper"""
35
37
build_tree_contents(_upgrade1_template)
36
self.assertTrue(os.path.exists('foo'))
37
self.assertTrue(os.path.exists('.bzr/README'))
38
self.failUnlessExists('foo')
39
self.failUnlessExists('.bzr/README')
39
41
def test_upgrade_simple(self):
40
42
"""Upgrade simple v0.0.4 format to v5"""
72
74
eq(len(rev.parent_ids), 2)
73
75
eq(rev.parent_ids[1], 'wibble@wobble-2')
77
def test_upgrade_makes_dir_weaves(self):
78
build_tree_contents(_upgrade_dir_template)
80
self.failUnlessExists(
81
'.bzr/weaves/dir-20051005095101-da1441ea3fa6917a.weave')
77
84
_upgrade1_template = \
180
187
'\xd0\x9a`\x0c*W\x1aR\xc1\x94du\x08(\t\xb0\x91\xdeZ\xa3\x9cU\x9cm\x7f\x8dr\x1d\x10Ot\xb8\xc6\xcf\xa7\x907|\xfb-\xb1\xbd\xd3\xfb\xd5\x07\xeeD\xee\x08*\x02\x00\x00'
191
_upgrade_dir_template = [
194
'This is a Bazaar-NG control directory.\n'
195
'Do not change any files in this directory.\n'
197
( './.bzr/branch-format',
198
'Bazaar-NG branch, format 0.0.4\n'
200
( './.bzr/branch-lock',
203
( './.bzr/branch-name',
206
( './.bzr/inventory',
208
'<entry file_id="dir-20051005095101-da1441ea3fa6917a" kind="directory" name="dir" />\n'
211
( './.bzr/merged-patches',
214
( './.bzr/pending-merged-patches',
217
( './.bzr/pending-merges',
220
( './.bzr/revision-history',
221
'robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e\n'
223
( './.bzr/stat-cache',
224
'### bzr hashcache v5\n'
226
( './.bzr/text-store/', ),
227
( './.bzr/inventory-store/', ),
228
( './.bzr/inventory-store/robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e.gz',
229
'\x1f\x8b\x08\x00\x0c\xa2CC\x02\xff\xb3\xc9\xcc+K\xcd+\xc9/\xaa\xb4\xe3\xb2\x012\x8a*\x15\xd22sR\xe33Sl\x95R2\x8bt\x8d\x0c\x0cL\r'
230
"\x81\xd8\xc0\x12H\x19\xea\xa6$\x1a\x9a\x98\x18\xa6&\x1a\xa7%\x9aY\x1a\x9a'*)dg\xe6A\x94\xa6&\x83LQR\xc8K\xccM\x05\x0b()\xe8\x03\xcd\xd4G\xb2\x00\x00\xc2<\x94\xb1m\x00\x00\x00"
232
( './.bzr/revision-store/', ),
233
( './.bzr/revision-store/robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e.gz',
234
'\x1f\x8b\x08\x00\x0c\xa2CC\x02\xff\xa5OKj\xc30\x14\xdc\xfb\x14B\x8b\xec\x92<I\xd6\xc7\xc42\x85\xde\xa0\x17(\xb6\xf4\x9c\n'
235
'l\xa9H"\x90\x9c\xbe\xa6\xa9\xa1\x9b\xae\xbax\x0c\xcc\xe71\xd3g\xbc\x85\x12R$.\xadk\xa8\x15\xb3\xa5oi\xc2\\\xc9kZ\x96\x10\x0b9,\xf5\x92\xbf)\xf7\xf2\x83O\xe5\x14\xb1\x1e\xae\xf5BI\x887\x8c5\xe5\xfb{\xf0\x96\xfei>r\x00\xc9\xb6\x83n\x03sT\xa0\xe4<y\x83\xda\x1b\xc54\xfe~T>Ff\xe9\xcc:\xdd\x8e\xa6E\xc7@\xa2\x82I\xaaNL\xbas\\313)\x00\xb9\xe6\xe0(\xd9\x87\xfc\xb7A\r'
236
"+\x96:\xae\x9f\x962\xc6\x8d\x04i\x949\x01\x97R\xb7\x1d\x17O\xc3#E\xb4T(\x00\xa0C\xd3o\x892^q\x18\xbd'>\xe4\xfe\xbc\x13M\x7f\xde{\r"
237
'\xcd\x17\x85\xea\xba\x03l\x01\x00\x00'