/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-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    osutils,
25
25
    tests,
26
26
    )
27
 
from ..sixish import text_type
28
27
from . import (
29
28
    script,
30
29
    scenarios,
43
42
# '\xc3\xae' == u'\xee' == i with hat
44
43
# So these are u'path' and 'id' only with a circle and a hat. (shappo?)
45
44
example_conflicts = conflicts.ConflictList(
46
 
    [conflicts.MissingParent('Not deleting', u'p\xe5thg', b'\xc3\xaedg'),
47
 
     conflicts.ContentsConflict(u'p\xe5tha', None, b'\xc3\xaeda'),
 
45
    [conflicts.MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
 
46
     conflicts.ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),
48
47
     conflicts.TextConflict(u'p\xe5tha'),
49
 
     conflicts.PathConflict(u'p\xe5thb', u'p\xe5thc', b'\xc3\xaedb'),
 
48
     conflicts.PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
50
49
     conflicts.DuplicateID('Unversioned existing file',
51
50
                           u'p\xe5thc', u'p\xe5thc2',
52
 
                           b'\xc3\xaedc', b'\xc3\xaedc'),
53
 
     conflicts.DuplicateEntry('Moved existing file to',
54
 
                              u'p\xe5thdd.moved', u'p\xe5thd',
55
 
                              b'\xc3\xaedd', None),
56
 
     conflicts.ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
57
 
                          None, b'\xc3\xaed2e'),
58
 
     conflicts.UnversionedParent('Versioned directory',
59
 
                                 u'p\xe5thf', b'\xc3\xaedf'),
60
 
     conflicts.NonDirectoryParent('Created directory',
61
 
                                  u'p\xe5thg', b'\xc3\xaedg'),
62
 
     ])
 
51
                           '\xc3\xaedc', '\xc3\xaedc'),
 
52
    conflicts.DuplicateEntry('Moved existing file to',
 
53
                             u'p\xe5thdd.moved', u'p\xe5thd',
 
54
                             '\xc3\xaedd', None),
 
55
    conflicts.ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
 
56
                         None, '\xc3\xaed2e'),
 
57
    conflicts.UnversionedParent('Versioned directory',
 
58
                                u'p\xe5thf', '\xc3\xaedf'),
 
59
    conflicts.NonDirectoryParent('Created directory',
 
60
                                 u'p\xe5thg', '\xc3\xaedg'),
 
61
])
63
62
 
64
63
 
65
64
def vary_by_conflicts():
76
75
                                  ('hello.BASE', b'hello world1'),
77
76
                                  ])
78
77
        os.mkdir('hello.OTHER')
79
 
        tree.add('hello', b'q')
 
78
        tree.add('hello', 'q')
80
79
        l = conflicts.ConflictList([conflicts.TextConflict('hello')])
81
80
        l.remove_files(tree)
82
81
 
97
96
        check_select(clist(), tree_conflicts,
98
97
                     [''], ignore_misses=True, recurse=True)
99
98
 
100
 
        foobaz = conflicts.ContentsConflict('foo/baz')
 
99
        foobaz  = conflicts.ContentsConflict('foo/baz')
101
100
        tree_conflicts = clist([foobaz, bar])
102
101
 
103
102
        check_select(clist([bar]), clist([foobaz]),
108
107
 
109
108
        check_select(clist(), tree_conflicts,
110
109
                     ['foo'], ignore_misses=True, recurse=True)
111
 
        check_select(tree_conflicts, clist(), ['foo'], ignore_misses=True)
 
110
        check_select (tree_conflicts, clist(), ['foo'], ignore_misses=True)
112
111
 
113
112
    def test_resolve_conflicts_recursive(self):
114
113
        tree = self.make_branch_and_tree('.')
115
114
        self.build_tree(['dir/', 'dir/hello'])
116
115
        tree.add(['dir', 'dir/hello'])
117
116
 
118
 
        dirhello = conflicts.ConflictList(
119
 
            [conflicts.TextConflict('dir/hello')])
 
117
        dirhello = conflicts.ConflictList([conflicts.TextConflict('dir/hello')])
120
118
        tree.set_conflicts(dirhello)
121
119
 
122
120
        conflicts.resolve(tree, ['dir'], recursive=False, ignore_misses=True)
131
129
    scenarios = scenarios.multiply_scenarios(vary_by_conflicts())
132
130
 
133
131
    def test_stringification(self):
134
 
        text = text_type(self.conflict)
 
132
        text = unicode(self.conflict)
135
133
        self.assertContainsString(text, self.conflict.path)
136
134
        self.assertContainsString(text.lower(), "conflict")
137
135
        self.assertContainsString(repr(self.conflict),
138
 
                                  self.conflict.__class__.__name__)
 
136
            self.conflict.__class__.__name__)
139
137
 
140
138
    def test_stanza_roundtrip(self):
141
139
        p = self.conflict
142
140
        o = conflicts.Conflict.factory(**p.as_stanza().as_dict())
143
141
        self.assertEqual(o, p)
144
142
 
145
 
        self.assertIsInstance(o.path, text_type)
 
143
        self.assertIsInstance(o.path, unicode)
146
144
 
147
145
        if o.file_id is not None:
148
 
            self.assertIsInstance(o.file_id, bytes)
 
146
            self.assertIsInstance(o.file_id, str)
149
147
 
150
148
        conflict_path = getattr(o, 'conflict_path', None)
151
149
        if conflict_path is not None:
152
 
            self.assertIsInstance(conflict_path, text_type)
 
150
            self.assertIsInstance(conflict_path, unicode)
153
151
 
154
152
        conflict_file_id = getattr(o, 'conflict_file_id', None)
155
153
        if conflict_file_id is not None:
156
 
            self.assertIsInstance(conflict_file_id, bytes)
 
154
            self.assertIsInstance(conflict_file_id, str)
157
155
 
158
156
    def test_stanzification(self):
159
157
        stanza = self.conflict.as_stanza()
176
174
 
177
175
    def test_stringification(self):
178
176
        for text, o in zip(example_conflicts.to_strings(), example_conflicts):
179
 
            self.assertEqual(text, text_type(o))
 
177
            self.assertEqual(text, unicode(o))
180
178
 
181
179
 
182
180
# FIXME: The shell-like tests should be converted to real whitebox tests... or
187
185
# FIXME: Tests missing for DuplicateID conflict type
188
186
class TestResolveConflicts(script.TestCaseWithTransportAndScript):
189
187
 
190
 
    preamble = None  # The setup script set by daughter classes
 
188
    preamble = None # The setup script set by daughter classes
191
189
 
192
190
    def setUp(self):
193
191
        super(TestResolveConflicts, self).setUp()
305
303
 
306
304
        # Create an empty trunk
307
305
        builder.build_snapshot(None, [
308
 
            ('add', (u'', b'root-id', 'directory', ''))],
309
 
            revision_id=b'start')
 
306
                ('add', ('', 'root-id', 'directory', ''))],
 
307
                revision_id='start')
310
308
        # Add a minimal base content
311
309
        base_actions = self._get_actions(self._base_actions)()
312
 
        builder.build_snapshot([b'start'], base_actions, revision_id=b'base')
 
310
        builder.build_snapshot(['start'], base_actions, revision_id='base')
313
311
        # Modify the base content in branch
314
312
        actions_other = self._get_actions(self._other['actions'])()
315
 
        builder.build_snapshot([b'base'], actions_other, revision_id=b'other')
 
313
        builder.build_snapshot(['base'], actions_other, revision_id='other')
316
314
        # Modify the base content in trunk
317
315
        actions_this = self._get_actions(self._this['actions'])()
318
 
        builder.build_snapshot([b'base'], actions_this, revision_id=b'this')
 
316
        builder.build_snapshot(['base'], actions_this, revision_id='this')
319
317
        # builder.get_branch() tip is now 'this'
320
318
 
321
319
        builder.finish_series()
330
328
    def _merge_other_into_this(self):
331
329
        b = self.builder.get_branch()
332
330
        wt = b.controldir.sprout('branch').open_workingtree()
333
 
        wt.merge_from_branch(b, b'other')
 
331
        wt.merge_from_branch(b, 'other')
334
332
        return wt
335
333
 
336
334
    def assertConflict(self, wt):
378
376
        [
379
377
            # File modified on both sides
380
378
            (dict(_base_actions='create_file',
381
 
                  _path='file', _file_id=b'file-id'),
 
379
                  _path='file', _file_id='file-id'),
382
380
             ('filed_modified_A',
383
381
              dict(actions='modify_file_A', check='file_has_content_A')),
384
382
             ('file_modified_B',
385
383
              dict(actions='modify_file_B', check='file_has_content_B')),),
386
384
            # File modified on both sides in dir
387
385
            (dict(_base_actions='create_file_in_dir',
388
 
                  _path='dir/file', _file_id=b'file-id'),
 
386
                  _path='dir/file', _file_id='file-id'),
389
387
             ('filed_modified_A_in_dir',
390
388
              dict(actions='modify_file_A_in_dir',
391
389
                   check='file_in_dir_has_content_A')),
395
393
            ])
396
394
 
397
395
    def do_create_file(self, path='file'):
398
 
        return [('add', (path, b'file-id', 'file', b'trunk content\n'))]
 
396
        return [('add', (path, 'file-id', 'file', 'trunk content\n'))]
399
397
 
400
398
    def do_modify_file_A(self):
401
 
        return [('modify', ('file', b'trunk content\nfeature A\n'))]
 
399
        return [('modify', ('file', 'trunk content\nfeature A\n'))]
402
400
 
403
401
    def do_modify_file_B(self):
404
 
        return [('modify', ('file', b'trunk content\nfeature B\n'))]
 
402
        return [('modify', ('file', 'trunk content\nfeature B\n'))]
405
403
 
406
404
    def do_modify_file_A_in_dir(self):
407
 
        return [('modify', ('dir/file', b'trunk content\nfeature A\n'))]
 
405
        return [('modify', ('dir/file', 'trunk content\nfeature A\n'))]
408
406
 
409
407
    def do_modify_file_B_in_dir(self):
410
 
        return [('modify', ('dir/file', b'trunk content\nfeature B\n'))]
 
408
        return [('modify', ('dir/file', 'trunk content\nfeature B\n'))]
411
409
 
412
410
    def check_file_has_content_A(self, path='file'):
413
 
        self.assertFileEqual(b'trunk content\nfeature A\n',
 
411
        self.assertFileEqual('trunk content\nfeature A\n',
414
412
                             osutils.pathjoin('branch', path))
415
413
 
416
414
    def check_file_has_content_B(self, path='file'):
417
 
        self.assertFileEqual(b'trunk content\nfeature B\n',
 
415
        self.assertFileEqual('trunk content\nfeature B\n',
418
416
                             osutils.pathjoin('branch', path))
419
417
 
420
418
    def do_create_file_in_dir(self):
421
 
        return [('add', ('dir', b'dir-id', 'directory', '')),
422
 
                ] + self.do_create_file('dir/file')
 
419
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
420
            ] + self.do_create_file('dir/file')
423
421
 
424
422
    def check_file_in_dir_has_content_A(self):
425
423
        self.check_file_has_content_A('dir/file')
449
447
        [
450
448
            # File modified/deleted
451
449
            (dict(_base_actions='create_file',
452
 
                  _path='file', _file_id=b'file-id'),
 
450
                  _path='file', _file_id='file-id'),
453
451
             ('file_modified',
454
452
              dict(actions='modify_file', check='file_has_more_content')),
455
453
             ('file_deleted',
456
454
              dict(actions='delete_file', check='file_doesnt_exist')),),
457
455
            # File renamed-modified/deleted
458
456
            (dict(_base_actions='create_file',
459
 
                  _path='new-file', _file_id=b'file-id'),
 
457
                  _path='new-file', _file_id='file-id'),
460
458
             ('file_renamed_and_modified',
461
459
              dict(actions='modify_and_rename_file',
462
460
                   check='file_renamed_and_more_content')),
464
462
              dict(actions='delete_file', check='file_doesnt_exist')),),
465
463
            # File modified/deleted in dir
466
464
            (dict(_base_actions='create_file_in_dir',
467
 
                  _path='dir/file', _file_id=b'file-id'),
 
465
                  _path='dir/file', _file_id='file-id'),
468
466
             ('file_modified_in_dir',
469
467
              dict(actions='modify_file_in_dir',
470
468
                   check='file_in_dir_has_more_content')),
474
472
            ])
475
473
 
476
474
    def do_create_file(self):
477
 
        return [('add', ('file', b'file-id', 'file', b'trunk content\n'))]
 
475
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
478
476
 
479
477
    def do_modify_file(self):
480
 
        return [('modify', ('file', b'trunk content\nmore content\n'))]
 
478
        return [('modify', ('file', 'trunk content\nmore content\n'))]
481
479
 
482
480
    def do_modify_and_rename_file(self):
483
 
        return [('modify', ('new-file', b'trunk content\nmore content\n')),
 
481
        return [('modify', ('new-file', 'trunk content\nmore content\n')),
484
482
                ('rename', ('file', 'new-file'))]
485
483
 
486
484
    def check_file_has_more_content(self):
487
 
        self.assertFileEqual(b'trunk content\nmore content\n', 'branch/file')
 
485
        self.assertFileEqual('trunk content\nmore content\n', 'branch/file')
488
486
 
489
487
    def check_file_renamed_and_more_content(self):
490
 
        self.assertFileEqual(
491
 
            b'trunk content\nmore content\n', 'branch/new-file')
 
488
        self.assertFileEqual('trunk content\nmore content\n', 'branch/new-file')
492
489
 
493
490
    def do_delete_file(self):
494
491
        return [('unversion', 'file')]
500
497
        self.assertPathDoesNotExist('branch/file')
501
498
 
502
499
    def do_create_file_in_dir(self):
503
 
        return [('add', ('dir', b'dir-id', 'directory', '')),
504
 
                ('add', ('dir/file', b'file-id', 'file', b'trunk content\n'))]
 
500
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
501
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
505
502
 
506
503
    def do_modify_file_in_dir(self):
507
 
        return [('modify', ('dir/file', b'trunk content\nmore content\n'))]
 
504
        return [('modify', ('dir/file', 'trunk content\nmore content\n'))]
508
505
 
509
506
    def check_file_in_dir_has_more_content(self):
510
 
        self.assertFileEqual(
511
 
            b'trunk content\nmore content\n', 'branch/dir/file')
 
507
        self.assertFileEqual('trunk content\nmore content\n', 'branch/dir/file')
512
508
 
513
509
    def check_file_in_dir_doesnt_exist(self):
514
510
        self.assertPathDoesNotExist('branch/dir/file')
538
534
            (dict(_base_actions='create_file'),
539
535
             ('file_renamed',
540
536
              dict(actions='rename_file', check='file_renamed',
541
 
                   path='new-file', file_id=b'file-id')),
 
537
                   path='new-file', file_id='file-id')),
542
538
             ('file_deleted',
543
539
              dict(actions='delete_file', check='file_doesnt_exist',
544
540
                   # PathConflicts deletion handling requires a special
545
541
                   # hard-coded value
546
 
                   path='<deleted>', file_id=b'file-id')),),
 
542
                   path='<deleted>', file_id='file-id')),),
547
543
            # File renamed/deleted in dir
548
544
            (dict(_base_actions='create_file_in_dir'),
549
545
             ('file_renamed_in_dir',
550
546
              dict(actions='rename_file_in_dir', check='file_in_dir_renamed',
551
 
                   path='dir/new-file', file_id=b'file-id')),
 
547
                   path='dir/new-file', file_id='file-id')),
552
548
             ('file_deleted',
553
549
              dict(actions='delete_file_in_dir', check='file_in_dir_doesnt_exist',
554
550
                   # PathConflicts deletion handling requires a special
555
551
                   # hard-coded value
556
 
                   path='<deleted>', file_id=b'file-id')),),
 
552
                   path='<deleted>', file_id='file-id')),),
557
553
            # File renamed/renamed differently
558
554
            (dict(_base_actions='create_file'),
559
555
             ('file_renamed',
560
556
              dict(actions='rename_file', check='file_renamed',
561
 
                   path='new-file', file_id=b'file-id')),
 
557
                   path='new-file', file_id='file-id')),
562
558
             ('file_renamed2',
563
559
              dict(actions='rename_file2', check='file_renamed2',
564
 
                   path='new-file2', file_id=b'file-id')),),
 
560
                   path='new-file2', file_id='file-id')),),
565
561
            # Dir renamed/deleted
566
562
            (dict(_base_actions='create_dir'),
567
563
             ('dir_renamed',
568
564
              dict(actions='rename_dir', check='dir_renamed',
569
 
                   path='new-dir', file_id=b'dir-id')),
 
565
                   path='new-dir', file_id='dir-id')),
570
566
             ('dir_deleted',
571
567
              dict(actions='delete_dir', check='dir_doesnt_exist',
572
568
                   # PathConflicts deletion handling requires a special
573
569
                   # hard-coded value
574
 
                   path='<deleted>', file_id=b'dir-id')),),
 
570
                   path='<deleted>', file_id='dir-id')),),
575
571
            # Dir renamed/renamed differently
576
572
            (dict(_base_actions='create_dir'),
577
573
             ('dir_renamed',
578
574
              dict(actions='rename_dir', check='dir_renamed',
579
 
                   path='new-dir', file_id=b'dir-id')),
 
575
                   path='new-dir', file_id='dir-id')),
580
576
             ('dir_renamed2',
581
577
              dict(actions='rename_dir2', check='dir_renamed2',
582
 
                   path='new-dir2', file_id=b'dir-id')),),
 
578
                   path='new-dir2', file_id='dir-id')),),
583
579
            ])
584
580
 
585
581
    def do_create_file(self):
586
 
        return [('add', ('file', b'file-id', 'file', b'trunk content\n'))]
 
582
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
587
583
 
588
584
    def do_create_dir(self):
589
 
        return [('add', ('dir', b'dir-id', 'directory', ''))]
 
585
        return [('add', ('dir', 'dir-id', 'directory', ''))]
590
586
 
591
587
    def do_rename_file(self):
592
588
        return [('rename', ('file', 'new-file'))]
632
628
        self.assertPathDoesNotExist('branch/dir')
633
629
 
634
630
    def do_create_file_in_dir(self):
635
 
        return [('add', ('dir', b'dir-id', 'directory', '')),
636
 
                ('add', ('dir/file', b'file-id', 'file', b'trunk content\n'))]
 
631
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
632
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
637
633
 
638
634
    def do_rename_file_in_dir(self):
639
635
        return [('rename', ('dir/file', 'dir/new-file'))]
659
655
        tfile_id = self._this['file_id']
660
656
        opath = self._other['path']
661
657
        ofile_id = self._other['file_id']
662
 
        self.assertEqual(tfile_id, ofile_id)  # Sanity check
 
658
        self.assertEqual(tfile_id, ofile_id) # Sanity check
663
659
        self.assertEqual(tfile_id, c.file_id)
664
660
        self.assertEqual(tpath, c.path)
665
661
        self.assertEqual(opath, c.conflict_path)
689
685
            (dict(_base_actions='nothing'),
690
686
             ('filea_created',
691
687
              dict(actions='create_file_a', check='file_content_a',
692
 
                   path='file', file_id=b'file-a-id')),
 
688
                   path='file', file_id='file-a-id')),
693
689
             ('fileb_created',
694
690
              dict(actions='create_file_b', check='file_content_b',
695
 
                   path='file', file_id=b'file-b-id')),),
 
691
                   path='file', file_id='file-b-id')),),
696
692
            # File created with different file-ids but deleted on one side
697
693
            (dict(_base_actions='create_file_a'),
698
694
             ('filea_replaced',
699
695
              dict(actions='replace_file_a_by_b', check='file_content_b',
700
 
                   path='file', file_id=b'file-b-id')),
 
696
                   path='file', file_id='file-b-id')),
701
697
             ('filea_modified',
702
698
              dict(actions='modify_file_a', check='file_new_content',
703
 
                   path='file', file_id=b'file-a-id')),),
 
699
                   path='file', file_id='file-a-id')),),
704
700
            ])
705
701
 
706
702
    def do_nothing(self):
707
703
        return []
708
704
 
709
705
    def do_create_file_a(self):
710
 
        return [('add', ('file', b'file-a-id', 'file', b'file a content\n'))]
 
706
        return [('add', ('file', 'file-a-id', 'file', 'file a content\n'))]
711
707
 
712
708
    def check_file_content_a(self):
713
 
        self.assertFileEqual(b'file a content\n', 'branch/file')
 
709
        self.assertFileEqual('file a content\n', 'branch/file')
714
710
 
715
711
    def do_create_file_b(self):
716
 
        return [('add', ('file', b'file-b-id', 'file', b'file b content\n'))]
 
712
        return [('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
717
713
 
718
714
    def check_file_content_b(self):
719
 
        self.assertFileEqual(b'file b content\n', 'branch/file')
 
715
        self.assertFileEqual('file b content\n', 'branch/file')
720
716
 
721
717
    def do_replace_file_a_by_b(self):
722
718
        return [('unversion', 'file'),
723
 
                ('add', ('file', b'file-b-id', 'file', b'file b content\n'))]
 
719
                ('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
724
720
 
725
721
    def do_modify_file_a(self):
726
 
        return [('modify', ('file', b'new content\n'))]
 
722
        return [('modify', ('file', 'new content\n'))]
727
723
 
728
724
    def check_file_new_content(self):
729
 
        self.assertFileEqual(b'new content\n', 'branch/file')
 
725
        self.assertFileEqual('new content\n', 'branch/file')
730
726
 
731
727
    def _get_resolve_path_arg(self, wt, action):
732
728
        return self._this['path']
736
732
        tfile_id = self._this['file_id']
737
733
        opath = self._other['path']
738
734
        ofile_id = self._other['file_id']
739
 
        self.assertEqual(tpath, opath)  # Sanity check
 
735
        self.assertEqual(tpath, opath) # Sanity check
740
736
        self.assertEqual(tfile_id, c.file_id)
741
737
        self.assertEqual(tpath + '.moved', c.path)
742
738
        self.assertEqual(tpath, c.conflict_path)
936
932
            (dict(_base_actions='create_dir1_dir2'),
937
933
             ('dir1_into_dir2',
938
934
              dict(actions='move_dir1_into_dir2', check='dir1_moved',
939
 
                   dir_id=b'dir1-id', target_id=b'dir2-id', xfail=False)),
 
935
                   dir_id='dir1-id', target_id='dir2-id', xfail=False)),
940
936
             ('dir2_into_dir1',
941
937
              dict(actions='move_dir2_into_dir1', check='dir2_moved',
942
 
                   dir_id=b'dir2-id', target_id=b'dir1-id', xfail=False))),
 
938
                   dir_id='dir2-id', target_id='dir1-id', xfail=False))),
943
939
            # Subdirs moved into each other
944
940
            (dict(_base_actions='create_dir1_4'),
945
941
             ('dir1_into_dir4',
946
942
              dict(actions='move_dir1_into_dir4', check='dir1_2_moved',
947
 
                   dir_id=b'dir1-id', target_id=b'dir4-id', xfail=True)),
 
943
                   dir_id='dir1-id', target_id='dir4-id', xfail=True)),
948
944
             ('dir3_into_dir2',
949
945
              dict(actions='move_dir3_into_dir2', check='dir3_4_moved',
950
 
                   dir_id=b'dir3-id', target_id=b'dir2-id', xfail=True))),
 
946
                   dir_id='dir3-id', target_id='dir2-id', xfail=True))),
951
947
            ])
952
948
 
953
949
    def do_create_dir1_dir2(self):
954
 
        return [('add', ('dir1', b'dir1-id', 'directory', '')),
955
 
                ('add', ('dir2', b'dir2-id', 'directory', '')), ]
 
950
        return [('add', ('dir1', 'dir1-id', 'directory', '')),
 
951
                ('add', ('dir2', 'dir2-id', 'directory', '')),]
956
952
 
957
953
    def do_move_dir1_into_dir2(self):
958
954
        return [('rename', ('dir1', 'dir2/dir1'))]
969
965
        self.assertPathExists('branch/dir1/dir2')
970
966
 
971
967
    def do_create_dir1_4(self):
972
 
        return [('add', ('dir1', b'dir1-id', 'directory', '')),
973
 
                ('add', ('dir1/dir2', b'dir2-id', 'directory', '')),
974
 
                ('add', ('dir3', b'dir3-id', 'directory', '')),
975
 
                ('add', ('dir3/dir4', b'dir4-id', 'directory', '')), ]
 
968
        return [('add', ('dir1', 'dir1-id', 'directory', '')),
 
969
                ('add', ('dir1/dir2', 'dir2-id', 'directory', '')),
 
970
                ('add', ('dir3', 'dir3-id', 'directory', '')),
 
971
                ('add', ('dir3/dir4', 'dir4-id', 'directory', '')),]
976
972
 
977
973
    def do_move_dir1_into_dir4(self):
978
974
        return [('rename', ('dir1', 'dir3/dir4/dir1'))]
1028
1024
$ echo "Boo!" >foo
1029
1025
$ brz commit -q -m 'foo is now a file'
1030
1026
$ brz merge ../trunk
 
1027
2>+N  foo.new/bar
1031
1028
2>RK  foo => foo.new/
1032
 
2>+N  foo.new/bar
1033
1029
# FIXME: The message is misleading, foo.new *is* a directory when the message
1034
1030
# is displayed -- vila 090916
1035
1031
2>Conflict: foo.new is not a directory, but has files in it.  Created directory.
1188
1184
    def setUp(self):
1189
1185
        super(TestResolveActionOption, self).setUp()
1190
1186
        self.options = [conflicts.ResolveActionOption()]
1191
 
        self.parser = option.get_optparser(self.options)
 
1187
        self.parser = option.get_optparser(dict((o.name, o)
 
1188
                                                for o in self.options))
1192
1189
 
1193
1190
    def parse(self, args):
1194
1191
        return self.parser.parse_args(args)
1199
1196
 
1200
1197
    def test_done(self):
1201
1198
        opts, args = self.parse(['--action', 'done'])
1202
 
        self.assertEqual({'action': 'done'}, opts)
 
1199
        self.assertEqual({'action':'done'}, opts)
1203
1200
 
1204
1201
    def test_take_this(self):
1205
1202
        opts, args = self.parse(['--action', 'take-this'])