/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: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
     conflicts.DuplicateID('Unversioned existing file',
51
51
                           u'p\xe5thc', u'p\xe5thc2',
52
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
 
])
 
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
     ])
63
63
 
64
64
 
65
65
def vary_by_conflicts():
97
97
        check_select(clist(), tree_conflicts,
98
98
                     [''], ignore_misses=True, recurse=True)
99
99
 
100
 
        foobaz  = conflicts.ContentsConflict('foo/baz')
 
100
        foobaz = conflicts.ContentsConflict('foo/baz')
101
101
        tree_conflicts = clist([foobaz, bar])
102
102
 
103
103
        check_select(clist([bar]), clist([foobaz]),
108
108
 
109
109
        check_select(clist(), tree_conflicts,
110
110
                     ['foo'], ignore_misses=True, recurse=True)
111
 
        check_select (tree_conflicts, clist(), ['foo'], ignore_misses=True)
 
111
        check_select(tree_conflicts, clist(), ['foo'], ignore_misses=True)
112
112
 
113
113
    def test_resolve_conflicts_recursive(self):
114
114
        tree = self.make_branch_and_tree('.')
115
115
        self.build_tree(['dir/', 'dir/hello'])
116
116
        tree.add(['dir', 'dir/hello'])
117
117
 
118
 
        dirhello = conflicts.ConflictList([conflicts.TextConflict('dir/hello')])
 
118
        dirhello = conflicts.ConflictList(
 
119
            [conflicts.TextConflict('dir/hello')])
119
120
        tree.set_conflicts(dirhello)
120
121
 
121
122
        conflicts.resolve(tree, ['dir'], recursive=False, ignore_misses=True)
134
135
        self.assertContainsString(text, self.conflict.path)
135
136
        self.assertContainsString(text.lower(), "conflict")
136
137
        self.assertContainsString(repr(self.conflict),
137
 
            self.conflict.__class__.__name__)
 
138
                                  self.conflict.__class__.__name__)
138
139
 
139
140
    def test_stanza_roundtrip(self):
140
141
        p = self.conflict
186
187
# FIXME: Tests missing for DuplicateID conflict type
187
188
class TestResolveConflicts(script.TestCaseWithTransportAndScript):
188
189
 
189
 
    preamble = None # The setup script set by daughter classes
 
190
    preamble = None  # The setup script set by daughter classes
190
191
 
191
192
    def setUp(self):
192
193
        super(TestResolveConflicts, self).setUp()
304
305
 
305
306
        # Create an empty trunk
306
307
        builder.build_snapshot(None, [
307
 
                ('add', (u'', b'root-id', 'directory', ''))],
308
 
                revision_id=b'start')
 
308
            ('add', (u'', b'root-id', 'directory', ''))],
 
309
            revision_id=b'start')
309
310
        # Add a minimal base content
310
311
        base_actions = self._get_actions(self._base_actions)()
311
312
        builder.build_snapshot([b'start'], base_actions, revision_id=b'base')
418
419
 
419
420
    def do_create_file_in_dir(self):
420
421
        return [('add', ('dir', b'dir-id', 'directory', '')),
421
 
            ] + self.do_create_file('dir/file')
 
422
                ] + self.do_create_file('dir/file')
422
423
 
423
424
    def check_file_in_dir_has_content_A(self):
424
425
        self.check_file_has_content_A('dir/file')
486
487
        self.assertFileEqual(b'trunk content\nmore content\n', 'branch/file')
487
488
 
488
489
    def check_file_renamed_and_more_content(self):
489
 
        self.assertFileEqual(b'trunk content\nmore content\n', 'branch/new-file')
 
490
        self.assertFileEqual(
 
491
            b'trunk content\nmore content\n', 'branch/new-file')
490
492
 
491
493
    def do_delete_file(self):
492
494
        return [('unversion', 'file')]
505
507
        return [('modify', ('dir/file', b'trunk content\nmore content\n'))]
506
508
 
507
509
    def check_file_in_dir_has_more_content(self):
508
 
        self.assertFileEqual(b'trunk content\nmore content\n', 'branch/dir/file')
 
510
        self.assertFileEqual(
 
511
            b'trunk content\nmore content\n', 'branch/dir/file')
509
512
 
510
513
    def check_file_in_dir_doesnt_exist(self):
511
514
        self.assertPathDoesNotExist('branch/dir/file')
656
659
        tfile_id = self._this['file_id']
657
660
        opath = self._other['path']
658
661
        ofile_id = self._other['file_id']
659
 
        self.assertEqual(tfile_id, ofile_id) # Sanity check
 
662
        self.assertEqual(tfile_id, ofile_id)  # Sanity check
660
663
        self.assertEqual(tfile_id, c.file_id)
661
664
        self.assertEqual(tpath, c.path)
662
665
        self.assertEqual(opath, c.conflict_path)
733
736
        tfile_id = self._this['file_id']
734
737
        opath = self._other['path']
735
738
        ofile_id = self._other['file_id']
736
 
        self.assertEqual(tpath, opath) # Sanity check
 
739
        self.assertEqual(tpath, opath)  # Sanity check
737
740
        self.assertEqual(tfile_id, c.file_id)
738
741
        self.assertEqual(tpath + '.moved', c.path)
739
742
        self.assertEqual(tpath, c.conflict_path)
949
952
 
950
953
    def do_create_dir1_dir2(self):
951
954
        return [('add', ('dir1', b'dir1-id', 'directory', '')),
952
 
                ('add', ('dir2', b'dir2-id', 'directory', '')),]
 
955
                ('add', ('dir2', b'dir2-id', 'directory', '')), ]
953
956
 
954
957
    def do_move_dir1_into_dir2(self):
955
958
        return [('rename', ('dir1', 'dir2/dir1'))]
969
972
        return [('add', ('dir1', b'dir1-id', 'directory', '')),
970
973
                ('add', ('dir1/dir2', b'dir2-id', 'directory', '')),
971
974
                ('add', ('dir3', b'dir3-id', 'directory', '')),
972
 
                ('add', ('dir3/dir4', b'dir4-id', 'directory', '')),]
 
975
                ('add', ('dir3/dir4', b'dir4-id', 'directory', '')), ]
973
976
 
974
977
    def do_move_dir1_into_dir4(self):
975
978
        return [('rename', ('dir1', 'dir3/dir4/dir1'))]
1196
1199
 
1197
1200
    def test_done(self):
1198
1201
        opts, args = self.parse(['--action', 'done'])
1199
 
        self.assertEqual({'action':'done'}, opts)
 
1202
        self.assertEqual({'action': 'done'}, opts)
1200
1203
 
1201
1204
    def test_take_this(self):
1202
1205
        opts, args = self.parse(['--action', 'take-this'])