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

  • Committer: Jelmer Vernooij
  • Date: 2018-04-02 00:52:27 UTC
  • mfrom: (6939 work)
  • mto: This revision was merged to the branch mainline in revision 7274.
  • Revision ID: jelmer@jelmer.uk-20180402005227-pecflp1mvdjrjqd6
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
    def test_resolve_conflict_dir(self):
72
72
        tree = self.make_branch_and_tree('.')
73
 
        self.build_tree_contents([('hello', 'hello world4'),
74
 
                                  ('hello.THIS', 'hello world2'),
75
 
                                  ('hello.BASE', 'hello world1'),
 
73
        self.build_tree_contents([('hello', b'hello world4'),
 
74
                                  ('hello.THIS', b'hello world2'),
 
75
                                  ('hello.BASE', b'hello world1'),
76
76
                                  ])
77
77
        os.mkdir('hello.OTHER')
78
78
        tree.add('hello', 'q')
302
302
        builder.start_series()
303
303
 
304
304
        # Create an empty trunk
305
 
        builder.build_snapshot('start', None, [
306
 
                ('add', ('', 'root-id', 'directory', ''))])
 
305
        builder.build_snapshot(None, [
 
306
                ('add', ('', 'root-id', 'directory', ''))],
 
307
                revision_id='start')
307
308
        # Add a minimal base content
308
309
        base_actions = self._get_actions(self._base_actions)()
309
 
        builder.build_snapshot('base', ['start'], base_actions)
 
310
        builder.build_snapshot(['start'], base_actions, revision_id='base')
310
311
        # Modify the base content in branch
311
312
        actions_other = self._get_actions(self._other['actions'])()
312
 
        builder.build_snapshot('other', ['base'], actions_other)
 
313
        builder.build_snapshot(['base'], actions_other, revision_id='other')
313
314
        # Modify the base content in trunk
314
315
        actions_this = self._get_actions(self._this['actions'])()
315
 
        builder.build_snapshot('this', ['base'], actions_this)
 
316
        builder.build_snapshot(['base'], actions_this, revision_id='this')
316
317
        # builder.get_branch() tip is now 'this'
317
318
 
318
319
        builder.finish_series()
384
385
            (dict(_base_actions='create_file_in_dir',
385
386
                  _path='dir/file', _file_id='file-id'),
386
387
             ('filed_modified_A_in_dir',
387
 
              dict(actions='modify_file_A',
 
388
              dict(actions='modify_file_A_in_dir',
388
389
                   check='file_in_dir_has_content_A')),
389
390
             ('file_modified_B',
390
 
              dict(actions='modify_file_B',
 
391
              dict(actions='modify_file_B_in_dir',
391
392
                   check='file_in_dir_has_content_B')),),
392
393
            ])
393
394
 
395
396
        return [('add', (path, 'file-id', 'file', 'trunk content\n'))]
396
397
 
397
398
    def do_modify_file_A(self):
398
 
        return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
 
399
        return [('modify', ('file', 'trunk content\nfeature A\n'))]
399
400
 
400
401
    def do_modify_file_B(self):
401
 
        return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
 
402
        return [('modify', ('file', 'trunk content\nfeature B\n'))]
 
403
 
 
404
    def do_modify_file_A_in_dir(self):
 
405
        return [('modify', ('dir/file', 'trunk content\nfeature A\n'))]
 
406
 
 
407
    def do_modify_file_B_in_dir(self):
 
408
        return [('modify', ('dir/file', 'trunk content\nfeature B\n'))]
402
409
 
403
410
    def check_file_has_content_A(self, path='file'):
404
411
        self.assertFileEqual('trunk content\nfeature A\n',
460
467
              dict(actions='modify_file_in_dir',
461
468
                   check='file_in_dir_has_more_content')),
462
469
             ('file_deleted_in_dir',
463
 
              dict(actions='delete_file',
 
470
              dict(actions='delete_file_in_dir',
464
471
                   check='file_in_dir_doesnt_exist')),),
465
472
            ])
466
473
 
468
475
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
469
476
 
470
477
    def do_modify_file(self):
471
 
        return [('modify', ('file-id', 'trunk content\nmore content\n'))]
 
478
        return [('modify', ('file', 'trunk content\nmore content\n'))]
472
479
 
473
480
    def do_modify_and_rename_file(self):
474
 
        return [('modify', ('file-id', 'trunk content\nmore content\n')),
 
481
        return [('modify', ('new-file', 'trunk content\nmore content\n')),
475
482
                ('rename', ('file', 'new-file'))]
476
483
 
477
484
    def check_file_has_more_content(self):
481
488
        self.assertFileEqual('trunk content\nmore content\n', 'branch/new-file')
482
489
 
483
490
    def do_delete_file(self):
484
 
        return [('unversion', 'file-id')]
 
491
        return [('unversion', 'file')]
 
492
 
 
493
    def do_delete_file_in_dir(self):
 
494
        return [('unversion', 'dir/file')]
485
495
 
486
496
    def check_file_doesnt_exist(self):
487
497
        self.assertPathDoesNotExist('branch/file')
491
501
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
492
502
 
493
503
    def do_modify_file_in_dir(self):
494
 
        return [('modify', ('file-id', 'trunk content\nmore content\n'))]
 
504
        return [('modify', ('dir/file', 'trunk content\nmore content\n'))]
495
505
 
496
506
    def check_file_in_dir_has_more_content(self):
497
507
        self.assertFileEqual('trunk content\nmore content\n', 'branch/dir/file')
536
546
              dict(actions='rename_file_in_dir', check='file_in_dir_renamed',
537
547
                   path='dir/new-file', file_id='file-id')),
538
548
             ('file_deleted',
539
 
              dict(actions='delete_file', check='file_in_dir_doesnt_exist',
 
549
              dict(actions='delete_file_in_dir', check='file_in_dir_doesnt_exist',
540
550
                   # PathConflicts deletion handling requires a special
541
551
                   # hard-coded value
542
552
                   path='<deleted>', file_id='file-id')),),
603
613
        self.assertPathExists('branch/new-dir2')
604
614
 
605
615
    def do_delete_file(self):
606
 
        return [('unversion', 'file-id')]
 
616
        return [('unversion', 'file')]
 
617
 
 
618
    def do_delete_file_in_dir(self):
 
619
        return [('unversion', 'dir/file')]
607
620
 
608
621
    def check_file_doesnt_exist(self):
609
622
        self.assertPathDoesNotExist('branch/file')
610
623
 
611
624
    def do_delete_dir(self):
612
 
        return [('unversion', 'dir-id')]
 
625
        return [('unversion', 'dir')]
613
626
 
614
627
    def check_dir_doesnt_exist(self):
615
628
        self.assertPathDoesNotExist('branch/dir')
702
715
        self.assertFileEqual('file b content\n', 'branch/file')
703
716
 
704
717
    def do_replace_file_a_by_b(self):
705
 
        return [('unversion', 'file-a-id'),
 
718
        return [('unversion', 'file'),
706
719
                ('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
707
720
 
708
721
    def do_modify_file_a(self):
709
 
        return [('modify', ('file-a-id', 'new content\n'))]
 
722
        return [('modify', ('file', 'new content\n'))]
710
723
 
711
724
    def check_file_new_content(self):
712
725
        self.assertFileEqual('new content\n', 'branch/file')
1061
1074
        # trunk switched. As such it should certainly produce the same
1062
1075
        # conflict.
1063
1076
        self.assertRaises(errors.MalformedTransform,
1064
 
                          self.run_script,"""
 
1077
                          self.run_script, """
1065
1078
$ brz init trunk
1066
1079
...
1067
1080
$ cd trunk