53
53
t = b.revision_tree(rh[1])
54
54
eq(t.get_file_text(foo_id), 'new contents\n')
56
def test_upgrade_with_ghosts(self):
57
"""Upgrade v0.0.4 tree containing ghost references.
59
That is, some of the parents of revisions mentioned in the branch
60
aren't present in the branches storage.
62
This shouldn't normally happen in branches created entirely in
63
bzr but can happen in imports from baz and arch, or from other
64
systems, where the importer knows about a revision but not
66
eq = self.assertEquals
67
build_tree_contents(_ghost_template)
57
73
_upgrade1_template = \
59
('foo', 'new contents\n'),
62
'This is a Bazaar-NG control directory.\nDo not change any files in this directory.\n'),
63
('.bzr/branch-format', 'Bazaar-NG branch, format 0.0.4\n'),
64
('.bzr/revision-history',
65
'mbp@sourcefrog.net-20051004035611-176b16534b086b3c\n'
66
'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd\n'),
67
('.bzr/merged-patches', ''),
68
('.bzr/pending-merged-patches', ''),
69
('.bzr/branch-name', ''),
70
('.bzr/branch-lock', ''),
71
('.bzr/pending-merges', ''),
74
'<entry file_id="foo-20051004035605-91e788d1875603ae" kind="file" name="foo" />\n'
77
'### bzr hashcache v5\n'
78
'foo// be9f309239729f69a6309e970ef24941d31e042c 13 1128398176 1128398176 303464 770\n'),
79
('.bzr/text-store/',),
80
('.bzr/text-store/foo-20051004035611-1591048e9dc7c2d4.gz',
81
'\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'),
82
('.bzr/text-store/foo-20051004035756-4081373d897c3453.gz',
83
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\xcbK-WH\xce\xcf+I\xcd+)\xe6\x02\x00g\xc3\xdf\xc9\r\x00\x00\x00'),
84
('.bzr/inventory-store/',),
85
('.bzr/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
86
'\x1f\x8b\x08\x00[\xfdAC\x02\xffm\x8f\xcd\n\xc20\x10\x84\xef>E\xc8\xbdt7?M\x02\xad\xaf"\xa1\x99`P[\xa8E\xacOo\x14\x05\x0f\xdef\xe1\xfbv\x98\xbeL7L\xeb\xbcl\xfb]_\xc3\xb2\x89\\\xce8\x944\xc8<\xcf\x8d"\xb2LdH\xdb\x8el\x13\x18\xce\xfb\xc4\xde\xd5SGHq*\xd3\x0b\xad\x8e\x14S\xbc\xe0\xadI\xb1\xe2\xbe\xfe}\xc2\xdc\xb0\rL\xc6#\xa4\xd1\x8d*\x99\x0f}=F\x1e$8G\x9d\xa0\x02\xa1rP9\x01c`FV\xda1qg\x98"\x02}\xa5\xf2\xa8\x95\xec\xa4h\xeb\x80\xf6g\xcd\x13\xb3\x01\xcc\x98\xda\x00\x00\x00'),
87
('.bzr/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
88
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xffm\x8f\xc1\n\xc20\x10D\xef~E\xc8\xbd\xb8\x9bM\x9a,\xb4\xfe\x8a\xc4f\x83Am\xa1\x16\xb1~\xbdQ\x14<x\x9b\x81y3LW\xc6\x9b\x8c\xcb4\xaf\xbbMW\xc5\xbc\xaa\\\xce\xb2/\xa9\xd7y\x9a\x1a\x03\xe0\x10\xc0\x02\xb9\x16\\\xc3(>\x84\x84\xc1WKQ\xb4:\x95\xf1\x15\xad\x8cVc\xbc\xc8\x1b\xd3j\x91\xfb\xf2\xaf\xa4r\x8d\x85\x80\xe4)\x05\xf6\x03YG\x9f\xf4\xf5\x18\xb1\xd7\x07\xe1L\xc0\x86\xd8\x1b\xce-\xc7\xb6:a\x0f\x92\x8de\x8b\x89P\xc0\x9a\xe1\x0b\x95G\x9d\xc4\xda\xb1\xad\x07\xb6?o\x9e\xb5\xff\xf0\xf9\xda\x00\x00\x00'),
89
('.bzr/revision-store/',),
90
('.bzr/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
91
'\x1f\x8b\x08\x00[\xfdAC\x02\xff\x9d\x8eKj\xc30\x14E\xe7^\x85\xd0 \xb3$\xefI\xd1\x8f\xd8\xa6\x1b(t\x07E?\xbb\x82H\n\xb2\x1ahW\xdfB1\x14:\xeb\xf4r\xee\xbdgl\xf1\x91\xb6T\x0b\xf15\xe7\xd4{l\x13}\xb6\xad\xa7B^j\xbd\x91\xc3\xad_\xb3\xbb?m\xf5\xbd\xf9\xb8\xb4\xba\x9eJ\xec\x87\xb5_)I\xe5\x11K\xaf\xed\xe35\x85\x89\xfe\xa5\x8e\x0c@ \xc0\x05\xb8\x90\x88GT\xd2\xa1\x14\xfc\xe2@K\xc7\xfd\xef\x85\xed\xcd\xe2D\x95\x8d\x1a\xa47<\x02c2\xb0 \xbc\xd0\x8ay\xa3\xbcp\x8a\x83\x12A3\xb7XJv\xef\x7f_\xf7\x94\xe3\xd6m\xbeO\x14\x91in4*<\x812\x88\xc60\xfc\x01>k\x89\x13\xe5\x12\x00\xe8<\x8c\xdf\x8d\xcd\xaeq\xb6!\x90\xa5\xd6\xf1\xbc\x07\xc3x\xde\x85\xe6\xe1\x0b\xc8\x8a\x98\x03T\x01\x00\x00'),
92
('.bzr/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
93
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\x9d\x90Kj\x031\x0c\x86\xf79\xc5\xe0Ev\xe9\xc8o\x9b\xcc\x84^\xa0\xd0\x1b\x14\xbf&5d\xec`\xbb\x81\xf6\xf45\x84\xa4\x81\xaeZ\xa1\x85\x84^\xdf\xaf\xa9\x84K\xac1\xa7\xc1\xe5u\x8d\xad\x852\xa3\x17SZL\xc3k\xce\xa7a{j\xfb\xd5\x9e\x9fk\xfe(.,%\x1f\x9fRh\xdbc\xdb\xa3!\xa6KH-\x97\xcf\xb7\xe8g\xf4\xbbkG\x008\x06`@\xb9\xe4bG(_\x88\x95\xde\xf9n\xca\xfb\xc7\r\xf5\xdd\xe0\x19\xa9\x85)\x81\xf5"\xbd\x04j\xb8\x02b\xa8W\\\x0b\xc9\x14\xf4\xbc\xbb\xd7\xd6H4\xdc\xb8\xff}\xba\xc55\xd4f\xd6\xf3\x8c0&\x8ajE\xa4x\xe2@\xa5\xa6\x9a\xf3k\xc3WNaFT\x00\x00:l\xa6>Q\xcd1\x1cjp9\xf9;\xc34\xde\n\x9b\xe9lJWT{t\',a\xf9\x0b\xae\xc0x\x87\xa5\xb0Xp\xca,(a\xa9{\xd0{}\xd4\x12\x04(\xc5\xbb$\xc5$V\xceaI\x19\x01\xa2\x1dh\xed\x82d\x8c.\xccr@\xc3\xd8Q\xc6\x1f\xaa\xf1\xb6\xe8\xb0\xf9\x06QR\r\xf9\xfc\x01\x00\x00')]
75
('foo', 'new contents\n'),
78
'This is a Bazaar-NG control directory.\nDo not change any files in this directory.\n'),
79
('.bzr/branch-format', 'Bazaar-NG branch, format 0.0.4\n'),
80
('.bzr/revision-history',
81
'mbp@sourcefrog.net-20051004035611-176b16534b086b3c\n'
82
'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd\n'),
83
('.bzr/merged-patches', ''),
84
('.bzr/pending-merged-patches', ''),
85
('.bzr/branch-name', ''),
86
('.bzr/branch-lock', ''),
87
('.bzr/pending-merges', ''),
90
'<entry file_id="foo-20051004035605-91e788d1875603ae" kind="file" name="foo" />\n'
93
'### bzr hashcache v5\n'
94
'foo// be9f309239729f69a6309e970ef24941d31e042c 13 1128398176 1128398176 303464 770\n'),
95
('.bzr/text-store/',),
96
('.bzr/text-store/foo-20051004035611-1591048e9dc7c2d4.gz',
97
'\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'),
98
('.bzr/text-store/foo-20051004035756-4081373d897c3453.gz',
99
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\xcbK-WH\xce\xcf+I\xcd+)\xe6\x02\x00g\xc3\xdf\xc9\r\x00\x00\x00'),
100
('.bzr/inventory-store/',),
101
('.bzr/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
102
'\x1f\x8b\x08\x00[\xfdAC\x02\xffm\x8f\xcd\n\xc20\x10\x84\xef>E\xc8\xbdt7?M\x02\xad\xaf"\xa1\x99`P[\xa8E\xacOo\x14\x05\x0f\xdef\xe1\xfbv\x98\xbeL7L\xeb\xbcl\xfb]_\xc3\xb2\x89\\\xce8\x944\xc8<\xcf\x8d"\xb2LdH\xdb\x8el\x13\x18\xce\xfb\xc4\xde\xd5SGHq*\xd3\x0b\xad\x8e\x14S\xbc\xe0\xadI\xb1\xe2\xbe\xfe}\xc2\xdc\xb0\rL\xc6#\xa4\xd1\x8d*\x99\x0f}=F\x1e$8G\x9d\xa0\x02\xa1rP9\x01c`FV\xda1qg\x98"\x02}\xa5\xf2\xa8\x95\xec\xa4h\xeb\x80\xf6g\xcd\x13\xb3\x01\xcc\x98\xda\x00\x00\x00'),
103
('.bzr/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
104
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xffm\x8f\xc1\n\xc20\x10D\xef~E\xc8\xbd\xb8\x9bM\x9a,\xb4\xfe\x8a\xc4f\x83Am\xa1\x16\xb1~\xbdQ\x14<x\x9b\x81y3LW\xc6\x9b\x8c\xcb4\xaf\xbbMW\xc5\xbc\xaa\\\xce\xb2/\xa9\xd7y\x9a\x1a\x03\xe0\x10\xc0\x02\xb9\x16\\\xc3(>\x84\x84\xc1WKQ\xb4:\x95\xf1\x15\xad\x8cVc\xbc\xc8\x1b\xd3j\x91\xfb\xf2\xaf\xa4r\x8d\x85\x80\xe4)\x05\xf6\x03YG\x9f\xf4\xf5\x18\xb1\xd7\x07\xe1L\xc0\x86\xd8\x1b\xce-\xc7\xb6:a\x0f\x92\x8de\x8b\x89P\xc0\x9a\xe1\x0b\x95G\x9d\xc4\xda\xb1\xad\x07\xb6?o\x9e\xb5\xff\xf0\xf9\xda\x00\x00\x00'),
105
('.bzr/revision-store/',),
106
('.bzr/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
107
'\x1f\x8b\x08\x00[\xfdAC\x02\xff\x9d\x8eKj\xc30\x14E\xe7^\x85\xd0 \xb3$\xefI\xd1\x8f\xd8\xa6\x1b(t\x07E?\xbb\x82H\n\xb2\x1ahW\xdfB1\x14:\xeb\xf4r\xee\xbdgl\xf1\x91\xb6T\x0b\xf15\xe7\xd4{l\x13}\xb6\xad\xa7B^j\xbd\x91\xc3\xad_\xb3\xbb?m\xf5\xbd\xf9\xb8\xb4\xba\x9eJ\xec\x87\xb5_)I\xe5\x11K\xaf\xed\xe35\x85\x89\xfe\xa5\x8e\x0c@ \xc0\x05\xb8\x90\x88GT\xd2\xa1\x14\xfc\xe2@K\xc7\xfd\xef\x85\xed\xcd\xe2D\x95\x8d\x1a\xa47<\x02c2\xb0 \xbc\xd0\x8ay\xa3\xbcp\x8a\x83\x12A3\xb7XJv\xef\x7f_\xf7\x94\xe3\xd6m\xbeO\x14\x91in4*<\x812\x88\xc60\xfc\x01>k\x89\x13\xe5\x12\x00\xe8<\x8c\xdf\x8d\xcd\xaeq\xb6!\x90\xa5\xd6\xf1\xbc\x07\xc3x\xde\x85\xe6\xe1\x0b\xc8\x8a\x98\x03T\x01\x00\x00'),
108
('.bzr/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
109
'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\x9d\x90Kj\x031\x0c\x86\xf79\xc5\xe0Ev\xe9\xc8o\x9b\xcc\x84^\xa0\xd0\x1b\x14\xbf&5d\xec`\xbb\x81\xf6\xf45\x84\xa4\x81\xaeZ\xa1\x85\x84^\xdf\xaf\xa9\x84K\xac1\xa7\xc1\xe5u\x8d\xad\x852\xa3\x17SZL\xc3k\xce\xa7a{j\xfb\xd5\x9e\x9fk\xfe(.,%\x1f\x9fRh\xdbc\xdb\xa3!\xa6KH-\x97\xcf\xb7\xe8g\xf4\xbbkG\x008\x06`@\xb9\xe4bG(_\x88\x95\xde\xf9n\xca\xfb\xc7\r\xf5\xdd\xe0\x19\xa9\x85)\x81\xf5"\xbd\x04j\xb8\x02b\xa8W\\\x0b\xc9\x14\xf4\xbc\xbb\xd7\xd6H4\xdc\xb8\xff}\xba\xc55\xd4f\xd6\xf3\x8c0&\x8ajE\xa4x\xe2@\xa5\xa6\x9a\xf3k\xc3WNaFT\x00\x00:l\xa6>Q\xcd1\x1cjp9\xf9;\xc34\xde\n\x9b\xe9lJWT{t\',a\xf9\x0b\xae\xc0x\x87\xa5\xb0Xp\xca,(a\xa9{\xd0{}\xd4\x12\x04(\xc5\xbb$\xc5$V\xceaI\x19\x01\xa2\x1dh\xed\x82d\x8c.\xccr@\xc3\xd8Q\xc6\x1f\xaa\xf1\xb6\xe8\xb0\xf9\x06QR\r\xf9\xfc\x01\x00\x00')]
126
'This is a Bazaar-NG control directory.\n'
127
'Do not change any files in this directory.\n'
131
'./.bzr/branch-format'
133
'Bazaar-NG branch, format 0.0.4\n'
152
'<entry file_id="foo-20051004104918-0379cb7c76354cde" kind="file" name="foo" />\n'
157
'./.bzr/merged-patches'
163
'./.bzr/pending-merged-patches'
169
'./.bzr/pending-merges'
175
'./.bzr/revision-history'
177
'mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b\n'
178
'mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d\n'
184
'### bzr hashcache v5\n'
185
'foo// f572d396fae9206628714fb2ce00f72e94f2258f 6 1128422956 1128422956 306900 770\n'
193
'./.bzr/text-store/foo-20051004104921-8de8118a71be45ba'
199
'./.bzr/inventory-store/'
203
'./.bzr/inventory-store/mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b'
206
'<entry file_id="foo-20051004104918-0379cb7c76354cde" kind="file" name="foo" text_id="foo-20051004104921-8de8118a71be45ba" text_sha1="f572d396fae9206628714fb2ce00f72e94f2258f" text_size="6" />\n'
211
'./.bzr/inventory-store/mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d'
214
'<entry file_id="foo-20051004104918-0379cb7c76354cde" kind="file" name="foo" text_id="foo-20051004104921-8de8118a71be45ba" text_sha1="f572d396fae9206628714fb2ce00f72e94f2258f" text_size="6" />\n'
219
'./.bzr/revision-store/'
223
'./.bzr/revision-store/mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b'
225
'<revision committer="Martin Pool <mbp@sourcefrog.net>" inventory_id="mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b" inventory_sha1="b01abf9b0a0c61efa5deb5d89c06316b7bb98cd1" revision_id="mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b" timestamp="1128422961.704761982" timezone="36000">\n'
226
'<message>first</message>\n'
231
'./.bzr/revision-store/mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d'
233
'<revision committer="Martin Pool <mbp@sourcefrog.net>" inventory_id="mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d" inventory_sha1="b01abf9b0a0c61efa5deb5d89c06316b7bb98cd1" revision_id="mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d" timestamp="1128422977.211585045" timezone="36000">\n'
234
'<message>merge of ghost</message>\n'
236
'<revision_ref revision_id="mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b" revision_sha1="e860ba9f99b6c39e6f93ea7ffb2e0b82daa96ca6" />\n'
237
'<revision_ref revision_id="wibble@wobble-2" />\n'