22
22
from bzrlib.branch import Branch
23
23
import bzrlib.bzrdir as bzrdir
24
24
from bzrlib.bzrdir import BzrDir
25
from bzrlib.conflicts import *
25
26
import bzrlib.errors as errors
26
27
from bzrlib.errors import NotBranchError, NotVersionedError
27
28
from bzrlib.lockdir import LockDir
203
204
self.assertTrue(our_lock.peek())
205
206
self.assertEquals(our_lock.peek(), None)
208
def create_format2_tree(self, url):
209
return BzrDir.create_standalone_workingtree(url)
211
def test_conflicts_format2(self):
212
# test backwards compatability
213
tree = self.create_format2_tree('.')
214
self.assertRaises(errors.UnsupportedOperation, tree.set_conflicts,
216
file('lala.BASE', 'wb').write('labase')
217
expected = ContentsConflict('lala')
218
self.assertEqual(list(tree.conflicts()), [expected])
219
file('lala', 'wb').write('la')
220
tree.add('lala', 'lala-id')
221
expected = ContentsConflict('lala', file_id='lala-id')
222
self.assertEqual(list(tree.conflicts()), [expected])
223
file('lala.THIS', 'wb').write('lathis')
224
file('lala.OTHER', 'wb').write('laother')
225
# When "text conflict"s happen, stem, THIS and OTHER are text
226
expected = TextConflict('lala', file_id='lala-id')
227
self.assertEqual(list(tree.conflicts()), [expected])
228
os.unlink('lala.OTHER')
229
os.mkdir('lala.OTHER')
230
expected = ContentsConflict('lala', file_id='lala-id')
231
self.assertEqual(list(tree.conflicts()), [expected])