/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 bzrlib/tests/test_workingtree.py

  • Committer: Michael Ellerman
  • Date: 2006-03-09 00:24:48 UTC
  • mto: (1610.1.8 bzr.mbp.integration)
  • mto: This revision was merged to the branch mainline in revision 1616.
  • Revision ID: michael@ellerman.id.au-20060309002448-70cce15e3d605130
Make the "ignore line" in the commit message editor the "right" width, so
that if you make your message that wide it won't wrap in bzr log output.
Just as a visual aid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# (C) 2005,2006 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
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 *
26
25
import bzrlib.errors as errors
27
26
from bzrlib.errors import NotBranchError, NotVersionedError
28
 
from bzrlib.lockdir import LockDir
29
27
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
30
 
from bzrlib.tests import TestCaseWithTransport, TestSkipped
 
28
from bzrlib.tests import TestCaseWithTransport
31
29
from bzrlib.trace import mutter
32
30
from bzrlib.transport import get_transport
33
31
import bzrlib.workingtree as workingtree
162
160
        tree = workingtree.WorkingTreeFormat3().initialize(control)
163
161
        # we want:
164
162
        # format 'Bazaar-NG Working Tree format 3'
 
163
        # lock ''
165
164
        # inventory = blank inventory
166
165
        # pending-merges = ''
167
166
        # stat-cache = ??
169
168
        t = control.get_workingtree_transport(None)
170
169
        self.assertEqualDiff('Bazaar-NG Working Tree format 3',
171
170
                             t.get('format').read())
 
171
        self.assertEqualDiff('', t.get('lock').read())
172
172
        self.assertEqualDiff('<inventory format="5">\n'
173
173
                             '</inventory>\n',
174
174
                             t.get('inventory').read())
179
179
        self.assertFalse(t.has('last-revision'))
180
180
        # TODO RBC 20060210 do a commit, check the inventory.basis is created 
181
181
        # correctly and last-revision file becomes present.
182
 
 
183
 
    def test_uses_lockdir(self):
184
 
        """WorkingTreeFormat3 uses its own LockDir:
185
 
            
186
 
            - lock is a directory
187
 
            - when the WorkingTree is locked, LockDir can see that
188
 
        """
189
 
        t = self.get_transport()
190
 
        url = self.get_url()
191
 
        dir = bzrdir.BzrDirMetaFormat1().initialize(url)
192
 
        repo = dir.create_repository()
193
 
        branch = dir.create_branch()
194
 
        try:
195
 
            tree = workingtree.WorkingTreeFormat3().initialize(dir)
196
 
        except errors.NotLocalUrl:
197
 
            raise TestSkipped('Not a local URL')
198
 
        self.assertIsDirectory('.bzr', t)
199
 
        self.assertIsDirectory('.bzr/checkout', t)
200
 
        self.assertIsDirectory('.bzr/checkout/lock', t)
201
 
        our_lock = LockDir(t, '.bzr/checkout/lock')
202
 
        self.assertEquals(our_lock.peek(), None)
203
 
        tree.lock_write()
204
 
        self.assertTrue(our_lock.peek())
205
 
        tree.unlock()
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])