/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/blackbox/test_resolve.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    conflicts,
19
19
    tests,
20
20
    )
21
 
from breezy.bzr import conflicts as _mod_bzr_conflicts
22
 
from breezy.tests import (
23
 
    script,
24
 
    KnownFailure,
25
 
    )
 
21
from breezy.tests import script
26
22
from breezy.tests.blackbox import test_conflicts
27
23
 
28
24
 
76
72
$ brz conflicts -d branch
77
73
""")
78
74
 
79
 
    def test_bug_842575_manual_rm(self):
80
 
        self.run_script("""\
81
 
$ brz init -q trunk
82
 
$ echo original > trunk/foo
83
 
$ brz add -q trunk/foo
84
 
$ brz commit -q -m first trunk
85
 
$ brz checkout -q trunk tree
86
 
$ brz rm -q trunk/foo
87
 
$ brz commit -q -m second trunk
88
 
$ echo modified > tree/foo
89
 
$ brz update tree
90
 
2>RM  foo => foo.THIS
91
 
2>Contents conflict in foo
92
 
2>1 conflicts encountered.
93
 
2>Updated to revision 2 of branch ...
94
 
$ rm tree/foo.BASE tree/foo.THIS
95
 
$ brz resolve --all -d tree
96
 
2>1 conflict resolved, 0 remaining
97
 
""")
98
 
        try:
99
 
            self.run_script("""\
100
 
$ brz status tree
101
 
""")
102
 
        except AssertionError:
103
 
            raise KnownFailure("bug #842575")
104
 
 
105
 
    def test_bug_842575_take_other(self):
106
 
        self.run_script("""\
107
 
$ brz init -q trunk
108
 
$ echo original > trunk/foo
109
 
$ brz add -q trunk/foo
110
 
$ brz commit -q -m first trunk
111
 
$ brz checkout -q --lightweight trunk tree
112
 
$ brz rm -q trunk/foo
113
 
$ brz ignore -d trunk foo
114
 
$ brz commit -q -m second trunk
115
 
$ echo modified > tree/foo
116
 
$ brz update tree
117
 
2>+N  .bzrignore
118
 
2>RM  foo => foo.THIS
119
 
2>Contents conflict in foo
120
 
2>1 conflicts encountered.
121
 
2>Updated to revision 2 of branch ...
122
 
$ brz resolve --take-other --all -d tree
123
 
2>1 conflict resolved, 0 remaining
124
 
""")
125
 
        try:
126
 
            self.run_script("""\
127
 
$ brz status tree
128
 
$ echo mustignore > tree/foo
129
 
$ brz status tree
130
 
""")
131
 
        except AssertionError:
132
 
            raise KnownFailure("bug 842575")
133
 
 
134
75
 
135
76
class TestBug788000(script.TestCaseWithTransportAndScript):
136
77
 
176
117
        """Text conflicts can be resolved automatically"""
177
118
        tree = self.make_branch_and_tree('tree')
178
119
        self.build_tree_contents([('tree/file',
179
 
                                   b'<<<<<<<\na\n=======\n>>>>>>>\n')])
180
 
        tree.add('file', b'file_id')
181
 
        self.assertEqual(tree.kind('file'), 'file')
182
 
        file_conflict = _mod_bzr_conflicts.TextConflict('file', file_id=b'file_id')
183
 
        tree.set_conflicts([file_conflict])
 
120
            '<<<<<<<\na\n=======\n>>>>>>>\n')])
 
121
        tree.add('file', 'file_id')
 
122
        self.assertEqual(tree.kind('file_id'), 'file')
 
123
        file_conflict = conflicts.TextConflict('file', file_id='file_id')
 
124
        tree.set_conflicts(conflicts.ConflictList([file_conflict]))
184
125
        note = self.run_bzr('resolve', retcode=1, working_dir='tree')[1]
185
126
        self.assertContainsRe(note, '0 conflicts auto-resolved.')
186
127
        self.assertContainsRe(note,
187
 
                              'Remaining conflicts:\nText conflict in file')
188
 
        self.build_tree_contents([('tree/file', b'a\n')])
 
128
            'Remaining conflicts:\nText conflict in file')
 
129
        self.build_tree_contents([('tree/file', 'a\n')])
189
130
        note = self.run_bzr('resolve', working_dir='tree')[1]
190
131
        self.assertContainsRe(note, 'All conflicts resolved.')