~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-03-24 05:21:02 UTC
  • mfrom: (4192 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4202.
  • Revision ID: mbp@sourcefrog.net-20090324052102-8kk087b32tep3d9h
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
                'symlink',
167
167
                 ]),
168
168
            set(iter(tree)))
169
 
        # note that the order of the paths and fileids is deliberately 
 
169
        # note that the order of the paths and fileids is deliberately
170
170
        # mismatched to ensure that the result order is path based.
171
171
        self.assertEqual(
172
172
            [('', tree_root, 'directory'),
199
199
                 u'0utf\u1234file'.encode('utf8'),
200
200
                 ]),
201
201
            set(iter(tree)))
202
 
        # note that the order of the paths and fileids is deliberately 
 
202
        # note that the order of the paths and fileids is deliberately
203
203
        # mismatched to ensure that the result order is path based.
204
204
        self.assertEqual(
205
205
            [('', tree_root, 'directory'),
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: