/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_repository/test_fetch.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-06-30 23:11:39 UTC
  • mfrom: (6973.12.13 python3-k)
  • Revision ID: breezy.the.bot@gmail.com-20180630231139-tf5t5khh6bu5ntpm
Fix some more tests on python3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-k/+merge/348646

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
 
110
110
    def do_test_fetch_to_rich_root_sets_parents_correctly(self, result,
111
111
        snapshots, root_id=ROOT_ID, allow_lefthand_ghost=False):
112
 
        """Assert that result is the parents of 'tip' after fetching snapshots.
 
112
        """Assert that result is the parents of b'tip' after fetching snapshots.
113
113
 
114
114
        This helper constructs a 1.9 format source, and a test-format target
115
115
        and fetches the result of building snapshots in the source, then
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')])
150
150
 
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', ''))]),
155
155
            ])
156
156
 
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', ''))]),
162
 
             ('tip', None, []),
 
161
            [(b'base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
 
162
             (b'tip', None, []),
163
163
            ])
164
164
 
165
165
    def test_fetch_to_rich_root_set_parent_1_ghost_parent(self):
168
168
            raise TestNotApplicable("repository format does not support "
169
169
                 "ghosts")
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)
173
173
 
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'], []),
182
182
            ])
183
183
 
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', ''))]),
189
 
             ('right', None, []),
190
 
             ('tip', ['left', 'right'], []),
 
189
             (b'right', None, []),
 
190
             (b'tip', ['left', b'right'], []),
191
191
            ])
192
192
 
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(
196
196
            (),
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', '')),
200
200
                            ]),
201
 
            ], root_id='my-root')
 
201
            ], root_id=b'my-root')
202
202
 
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', ''))]),
210
 
             ('base', None, []),
211
 
             ('tip', None, [('unversion', 'child'),
 
210
             (b'base', None, []),
 
211
             (b'tip', None, [('unversion', 'child'),
212
212
                            ('unversion', ''),
213
213
                            ('flush', None),
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', '')),
227
227
                            ]),
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', ''))]),
238
 
             ('base', None, []),
239
 
            # 'my-root' at root
240
 
             ('right', None, [('unversion', 'child'),
 
238
             (b'base', None, []),
 
239
            # b'my-root' at root
 
240
             (b'right', None, [('unversion', 'child'),
241
241
                              ('unversion', ''),
242
242
                              ('flush', None),
243
243
                              ('add', ('', b'my-root', 'directory', ''))]),
244
 
             ('tip', ['base', 'right'], [('unversion', ''),
 
244
             (b'tip', [b'base', b'right'], [('unversion', ''),
245
245
                            ('unversion', 'child'),
246
246
                            ('flush', None),
247
247
                            ('add', ('', b'my-root', 'directory', '')),
271
271
        # is present
272
272
        repo = tree.branch.repository.controldir.open_repository()
273
273
        self.assertRaises(errors.NoSuchRevision, tree.branch.repository.fetch,
274
 
                          repo, 'no-such-revision')
 
274
                          repo, b'no-such-revision')
275
275
 
276
276
    def makeARepoWithSignatures(self):
277
277
        wt = self.make_branch_and_tree('a-repo-with-sigs')