/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_inventory/basics.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    See test_inv which has comprehensive delta application tests for
86
86
    inventories, dirstate, and repository based inventories.
87
87
    """
 
88
 
88
89
    def test_add(self):
89
90
        inv = self.make_init_inventory()
90
91
        inv = inv.create_by_apply_delta([
111
112
        self.assertEqual('a', inv.id2path(b'a-id'))
112
113
        a_ie = inv.get_entry(b'a-id')
113
114
        b_ie = self.make_file(a_ie.file_id, "b", a_ie.parent_id)
114
 
        inv = inv.create_by_apply_delta([("a", "b", b"a-id", b_ie)], b'new-rev-2')
 
115
        inv = inv.create_by_apply_delta(
 
116
            [("a", "b", b"a-id", b_ie)], b'new-rev-2')
115
117
        self.assertEqual("b", inv.id2path(b'a-id'))
116
118
 
117
119
    def test_illegal(self):
188
190
            ('sub/a', b'a-id'),
189
191
            ('zz.c', b'zzc-id'),
190
192
            ], [(path, ie.file_id) for path, ie in inv.iter_entries(
191
 
            from_dir=b'src-id')])
 
193
                from_dir=b'src-id')])
192
194
 
193
195
        # Test not recursing at the root level
194
196
        self.assertEqual([
198
200
            ('src', b'src-id'),
199
201
            ('zz', b'zz-id'),
200
202
            ], [(path, ie.file_id) for path, ie in inv.iter_entries(
201
 
            recursive=False)])
 
203
                recursive=False)])
202
204
 
203
205
        # Test not recursing at a subdirectory level
204
206
        self.assertEqual([
207
209
            ('sub', b'sub-id'),
208
210
            ('zz.c', b'zzc-id'),
209
211
            ], [(path, ie.file_id) for path, ie in inv.iter_entries(
210
 
            from_dir=b'src-id', recursive=False)])
 
212
                from_dir=b'src-id', recursive=False)])
211
213
 
212
214
    def test_iter_just_entries(self):
213
215
        inv = self.prepare_inv_with_nested_dirs()
251
253
            ('src/sub/a', b'a-id'),
252
254
            ], [(path, ie.file_id) for path, ie in inv.iter_entries_by_dir(
253
255
                specific_file_ids=(b'a-id', b'zzc-id', b'doc-id', b'tree-root',
254
 
                b'hello-id', b'bye-id', b'zz-id', b'src-id', b'makefile-id',
255
 
                b'sub-id'))])
 
256
                                   b'hello-id', b'bye-id', b'zz-id', b'src-id', b'makefile-id',
 
257
                                   b'sub-id'))])
256
258
 
257
259
        self.assertEqual([
258
260
            ('Makefile', b'makefile-id'),
264
266
            ('src/sub/a', b'a-id'),
265
267
            ], [(path, ie.file_id) for path, ie in inv.iter_entries_by_dir(
266
268
                specific_file_ids=(b'a-id', b'zzc-id', b'doc-id',
267
 
                b'hello-id', b'bye-id', b'zz-id', b'makefile-id'))])
 
269
                                   b'hello-id', b'bye-id', b'zz-id', b'makefile-id'))])
268
270
 
269
271
        self.assertEqual([
270
272
            ('Makefile', b'makefile-id'),
282
284
            ('src/bye.c', b'bye-id'),
283
285
            ], [(path, ie.file_id) for path, ie in inv.iter_entries_by_dir(
284
286
                specific_file_ids=(b'bye-id',))])
285
 
 
 
287
 
286
288
 
287
289
class TestInventoryFiltering(TestInventory):
288
290
 
292
294
        self.assertEqual([
293
295
            ('', b'tree-root'),
294
296
            ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])
295
 
    
 
297
 
296
298
    def test_inv_filter_files(self):
297
299
        inv = self.prepare_inv_with_nested_dirs()
298
300
        new_inv = inv.filter([b'zz-id', b'hello-id', b'a-id'])
304
306
            ('src/sub/a', b'a-id'),
305
307
            ('zz', b'zz-id'),
306
308
            ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])
307
 
    
 
309
 
308
310
    def test_inv_filter_dirs(self):
309
311
        inv = self.prepare_inv_with_nested_dirs()
310
312
        new_inv = inv.filter([b'doc-id', b'sub-id'])