~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-09 16:49:22 UTC
  • mfrom: (1534.10.27 bzr.ttransform)
  • Revision ID: pqm@pqm.ubuntu.com-20060409164922-071803e906c8b96d
New conflict-handling system

Show diffs side-by-side

added added

removed removed

Lines of Context:
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())
204
205
        tree.unlock()
205
206
        self.assertEquals(our_lock.peek(), None)
 
207
 
 
208
    def create_format2_tree(self, url):
 
209
        return BzrDir.create_standalone_workingtree(url)
 
210
 
 
211
    def test_conflicts_format2(self):
 
212
        # test backwards compatability
 
213
        tree = self.create_format2_tree('.')
 
214
        self.assertRaises(errors.UnsupportedOperation, tree.set_conflicts,
 
215
                          None)
 
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])