~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_test_trees.py

Merge with get_file_sha1

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
 
217
217
        revision_id = u'r\xe9v-1'.encode('utf8')
218
218
        root_id = 'TREE_ROOT'
219
 
        bar_id = u'b\xe5r-id'.encode('utf8')
220
 
        foo_id = u'f\xf6-id'.encode('utf8')
221
 
        baz_id = u'b\xe1z-id'.encode('utf8')
222
 
        path_and_ids = [(u'', root_id, None),
223
 
                        (u'b\xe5r', bar_id, root_id),
224
 
                        (u'f\xf6', foo_id, root_id),
225
 
                        (u'b\xe5r/b\xe1z', baz_id, bar_id),
 
219
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
 
220
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
 
221
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
 
222
        path_and_ids = [(u'', root_id, None, None),
 
223
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id),
 
224
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id),
 
225
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
 
226
                         baz_id, bar_id, revision_id),
226
227
                       ]
227
228
        tree.lock_read()
228
229
        try:
260
261
        revision_id_1 = u'r\xe9v-1'.encode('utf8')
261
262
        revision_id_2 = u'r\xe9v-2'.encode('utf8')
262
263
        root_id = 'TREE_ROOT'
263
 
        bar_id = u'b\xe5r-id'.encode('utf8')
264
 
        foo_id = u'f\xf6-id'.encode('utf8')
265
 
        baz_id = u'b\xe1z-id'.encode('utf8')
266
 
        zez_id = u'z\xf7z-id'.encode('utf8')
 
264
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
 
265
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
 
266
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
 
267
        qux_id = u'qu\N{Euro Sign}x-id'.encode('utf8')
267
268
        path_and_ids = [(u'', root_id, None, None),
268
 
                        (u'b\xe5r', bar_id, root_id, revision_id_1),
269
 
                        (u'f\xf6', foo_id, root_id, revision_id_1),
270
 
                        (u'b\xe5r/b\xe1z', baz_id, bar_id, revision_id_1),
271
 
                        (u'b\xe5r/z\xf7z', zez_id, bar_id, revision_id_2),
 
269
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),
 
270
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),
 
271
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
 
272
                         baz_id, bar_id, revision_id_1),
 
273
                        (u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',
 
274
                         qux_id, bar_id, revision_id_2),
272
275
                       ]
273
276
        tree.lock_read()
274
277
        try:
276
279
        finally:
277
280
            tree.unlock()
278
281
 
279
 
        for expected, (path, ie) in zip(path_and_ids, path_entries):
280
 
            self.assertEqual(expected[0], path) # Paths should match
 
282
        for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,
 
283
                                                            path_entries):
 
284
            self.assertEqual(epath, path) # Paths should match
281
285
            self.assertIsInstance(path, unicode)
282
 
            self.assertEqual(expected[1], ie.file_id)
 
286
            self.assertEqual(efid, ie.file_id)
283
287
            self.assertIsInstance(ie.file_id, str)
284
 
            self.assertEqual(expected[2], ie.parent_id)
285
 
            if expected[2] is not None:
 
288
            self.assertEqual(eparent, ie.parent_id)
 
289
            if eparent is not None:
286
290
                self.assertIsInstance(ie.parent_id, str)
287
291
            # WorkingTree's return None for the last modified revision
288
292
            if ie.revision is not None:
289
293
                self.assertIsInstance(ie.revision, str)
290
 
                if expected[0] == '':
 
294
                if epath == '':
291
295
                    # Some trees will preserve the revision id of the tree root,
292
296
                    # but not all will
293
297
                    continue
294
 
                self.assertEqual(expected[3], ie.revision)
 
298
                self.assertEqual(erev, ie.revision)
295
299
        self.assertEqual(len(path_and_ids), len(path_entries))
296
300
        get_revision_id = getattr(tree, 'get_revision_id', None)
297
301
        if get_revision_id is not None: