/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/test_bundle.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-11 21:04:12 UTC
  • mfrom: (7031.1.4 python3-diff)
  • Revision ID: breezy.the.bot@gmail.com-20180711210412-l80sfib91f3uhwc0
Port diff and merge_directive to Python 3.

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
274
274
 
275
275
    def unified_diff(self, old, new):
276
276
        out = BytesIO()
277
 
        diff.internal_diff("old", old, "new", new, out)
 
277
        diff.internal_diff(b"old", old, b"new", new, out)
278
278
        out.seek(0, 0)
279
279
        return out.read()
280
280
 
290
290
    def test_adds(self):
291
291
        """File/inventory adds"""
292
292
        btree = self.make_tree_2()
293
 
        add_patch = self.unified_diff([], ["Extra cheese\n"])
 
293
        add_patch = self.unified_diff([], [b"Extra cheese\n"])
294
294
        btree.note_patch("grandparent/parent/file", add_patch)
295
295
        btree.note_id(b'f', 'grandparent/parent/symlink', kind='symlink')
296
296
        btree.note_target('grandparent/parent/symlink', 'venus')
308
308
        """File/inventory adds, with patch-compatibile renames"""
309
309
        btree = self.make_tree_2()
310
310
        btree.contents_by_id = False
311
 
        add_patch = self.unified_diff(["Hello\n"], ["Extra cheese\n"])
 
311
        add_patch = self.unified_diff([b"Hello\n"], [b"Extra cheese\n"])
312
312
        btree.note_patch("grandparent/parent/file", add_patch)
313
313
        btree.note_id(b'f', 'grandparent/parent/symlink', kind='symlink')
314
314
        btree.note_target('grandparent/parent/symlink', 'venus')
332
332
    def test_get_file(self):
333
333
        """Get file contents"""
334
334
        btree = self.make_tree_3()
335
 
        mod_patch = self.unified_diff(["Anchovies\n"], ["Lemon\n"])
 
335
        mod_patch = self.unified_diff([b"Anchovies\n"], [b"Lemon\n"])
336
336
        btree.note_patch("grandparent/alt_parent/stopping", mod_patch)
337
337
        self.get_file_test(btree)
338
338
 
340
340
        """Get file contents, with patch-compatible renames"""
341
341
        btree = self.make_tree_3()
342
342
        btree.contents_by_id = False
343
 
        mod_patch = self.unified_diff([], ["Lemon\n"])
 
343
        mod_patch = self.unified_diff([], [b"Lemon\n"])
344
344
        btree.note_patch("grandparent/alt_parent/stopping", mod_patch)
345
 
        mod_patch = self.unified_diff([], ["Hello\n"])
 
345
        mod_patch = self.unified_diff([], [b"Hello\n"])
346
346
        btree.note_patch("grandparent/alt_parent/file", mod_patch)
347
347
        self.get_file_test(btree)
348
348
 
1247
1247
                             )
1248
1248
        bundle = read_bundle(bundle_sio)
1249
1249
        revision_info = bundle.revisions[0]
1250
 
        self.assertEqual('rev1', revision_info.revision_id)
 
1250
        self.assertEqual(b'rev1', revision_info.revision_id)
1251
1251
        rev = revision_info.as_revision()
1252
1252
        self.assertEqual({'branch-nick':'tree', 'empty':'', 'one':'two'},
1253
1253
                         rev.properties)
1273
1273
                             )
1274
1274
        bundle = read_bundle(bundle_sio)
1275
1275
        revision_info = bundle.revisions[0]
1276
 
        self.assertEqual('rev1', revision_info.revision_id)
 
1276
        self.assertEqual(b'rev1', revision_info.revision_id)
1277
1277
        rev = revision_info.as_revision()
1278
1278
        self.assertEqual({'branch-nick':'tree', 'a':'4', 'b':'3', 'c':'2',
1279
1279
                          'd':'1'}, rev.properties)