146
146
repo.fetch(source.repository)
147
147
graph = repo.get_file_graph()
148
148
self.assertEqual(result,
149
graph.get_parent_map([(root_id, 'tip')])[(root_id, 'tip')])
149
graph.get_parent_map([(root_id, b'tip')])[(root_id, b'tip')])
151
151
def test_fetch_to_rich_root_set_parent_no_parents(self):
152
152
# No parents rev -> No parents
153
153
self.do_test_fetch_to_rich_root_sets_parents_correctly((),
154
[('tip', None, [('add', ('', ROOT_ID, 'directory', ''))]),
154
[(b'tip', None, [('add', ('', ROOT_ID, 'directory', ''))]),
157
157
def test_fetch_to_rich_root_set_parent_1_parent(self):
158
158
# 1 parent rev -> 1 parent
159
159
self.do_test_fetch_to_rich_root_sets_parents_correctly(
160
160
((ROOT_ID, 'base'),),
161
[('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
161
[(b'base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
165
165
def test_fetch_to_rich_root_set_parent_1_ghost_parent(self):
168
168
raise TestNotApplicable("repository format does not support "
170
170
self.do_test_fetch_to_rich_root_sets_parents_correctly((),
171
[('tip', ['ghost'], [('add', ('', ROOT_ID, 'directory', ''))]),
171
[(b'tip', ['ghost'], [('add', ('', ROOT_ID, 'directory', ''))]),
172
172
], allow_lefthand_ghost=True)
174
174
def test_fetch_to_rich_root_set_parent_2_head_parents(self):
175
175
# 2 parents both heads -> 2 parents
176
176
self.do_test_fetch_to_rich_root_sets_parents_correctly(
177
((ROOT_ID, 'left'), (ROOT_ID, 'right')),
178
[('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
177
((ROOT_ID, b'left'), (ROOT_ID, b'right')),
178
[(b'base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
179
179
('left', None, []),
180
('right', ['base'], []),
181
('tip', ['left', 'right'], []),
180
(b'right', [b'base'], []),
181
(b'tip', ['left', b'right'], []),
184
184
def test_fetch_to_rich_root_set_parent_2_parents_1_head(self):
185
185
# 2 parents one head -> 1 parent
186
186
self.do_test_fetch_to_rich_root_sets_parents_correctly(
187
((ROOT_ID, 'right'),),
187
((ROOT_ID, b'right'),),
188
188
[('left', None, [('add', ('', ROOT_ID, 'directory', ''))]),
190
('tip', ['left', 'right'], []),
189
(b'right', None, []),
190
(b'tip', ['left', b'right'], []),
193
193
def test_fetch_to_rich_root_set_parent_1_parent_different_id_gone(self):
194
194
# 1 parent different fileid, ours missing -> no parents
195
195
self.do_test_fetch_to_rich_root_sets_parents_correctly(
197
[('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
198
('tip', None, [('unversion', ''),
199
('add', ('', 'my-root', 'directory', '')),
197
[(b'base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
198
(b'tip', None, [('unversion', ''),
199
('add', ('', b'my-root', 'directory', '')),
201
], root_id='my-root')
201
], root_id=b'my-root')
203
203
def test_fetch_to_rich_root_set_parent_1_parent_different_id_moved(self):
204
204
# 1 parent different fileid, ours moved -> 1 parent
205
205
# (and that parent honours the changing revid of the other location)
206
206
self.do_test_fetch_to_rich_root_sets_parents_correctly(
207
(('my-root', 'origin'),),
207
((b'my-root', b'origin'),),
208
208
[('origin', None, [('add', ('', ROOT_ID, 'directory', '')),
209
209
('add', ('child', b'my-root', 'directory', ''))]),
211
('tip', None, [('unversion', 'child'),
211
(b'tip', None, [('unversion', 'child'),
212
212
('unversion', ''),
214
214
('add', ('', b'my-root', 'directory', '')),
218
218
def test_fetch_to_rich_root_set_parent_2_parent_1_different_id_gone(self):
219
219
# 2 parents, 1 different fileid, our second missing -> 1 parent
220
220
self.do_test_fetch_to_rich_root_sets_parents_correctly(
221
((b'my-root', 'right'),),
222
[('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
223
('right', None, [('unversion', ''),
221
((b'my-root', b'right'),),
222
[(b'base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
223
(b'right', None, [('unversion', ''),
224
224
('add', ('', b'my-root', 'directory', ''))]),
225
('tip', ['base', 'right'], [('unversion', ''),
225
(b'tip', [b'base', b'right'], [('unversion', ''),
226
226
('add', ('', b'my-root', 'directory', '')),
228
228
], root_id=b'my-root')
231
231
# 2 parents, 1 different fileid, our second moved -> 2 parent
232
232
# (and that parent honours the changing revid of the other location)
233
233
self.do_test_fetch_to_rich_root_sets_parents_correctly(
234
((b'my-root', 'right'),),
235
# 'my-root' at 'child'.
234
((b'my-root', b'right'),),
235
# b'my-root' at 'child'.
236
236
[('origin', None, [('add', ('', ROOT_ID, 'directory', '')),
237
237
('add', ('child', b'my-root', 'directory', ''))]),
240
('right', None, [('unversion', 'child'),
240
(b'right', None, [('unversion', 'child'),
241
241
('unversion', ''),
243
243
('add', ('', b'my-root', 'directory', ''))]),
244
('tip', ['base', 'right'], [('unversion', ''),
244
(b'tip', [b'base', b'right'], [('unversion', ''),
245
245
('unversion', 'child'),
247
247
('add', ('', b'my-root', 'directory', '')),