/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2052.3.10 by John Arbash Meinel
[merge] bzr.dev 2079
1
# Copyright (C) 2006 Canonical Ltd
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
16
17
"""Tests for WorkingTree.set_root_id"""
18
4648.1.3 by Robert Collins
Improve behaviour of tests that have a reasonable excuse for causing locking issues on windows selftest.
19
import sys
20
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
21
from bzrlib import inventory
4648.1.3 by Robert Collins
Improve behaviour of tests that have a reasonable excuse for causing locking issues on windows selftest.
22
from bzrlib.tests import TestSkipped
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
23
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
24
25
26
class TestSetRootId(TestCaseWithWorkingTree):
27
28
    def test_set_and_read_unicode(self):
4648.1.3 by Robert Collins
Improve behaviour of tests that have a reasonable excuse for causing locking issues on windows selftest.
29
        if sys.platform == "win32":
30
            raise TestSkipped("don't use oslocks on win32 in unix manner")
4595.13.1 by Alexander Belchenko
[cherrypick revno.4635 from bzr.dev] (robertc) Fix many locking errors on windows due to a small bug in merge.transform_tree. (Robert Collins)
31
        # This test tests that setting the root doesn't flush, so it
32
        # deliberately tests concurrent access that isn't possible on windows.
4627.2.4 by Robert Collins
Put back a test that needs unix relaxed behaviour.
33
        self.thisFailsStrictLockCheck()
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
34
        tree = self.make_branch_and_tree('a-tree')
35
        # setting the root id allows it to be read via get_root_id.
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
36
        root_id = u'\xe5n-id'.encode('utf8')
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
37
        tree.lock_write()
38
        try:
1986.5.3 by Robert Collins
New method ``WorkingTree.flush()`` which will write the current memory
39
            old_id = tree.get_root_id()
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
40
            tree.set_root_id(root_id)
41
            self.assertEqual(root_id, tree.get_root_id())
1986.5.3 by Robert Collins
New method ``WorkingTree.flush()`` which will write the current memory
42
            # set root id should not have triggered a flush of the tree,
43
            # so check a new tree sees the old state.
44
            reference_tree = tree.bzrdir.open_workingtree()
45
            self.assertEqual(old_id, reference_tree.get_root_id())
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
46
        finally:
47
            tree.unlock()
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
48
        # having unlocked the tree, the value should have been
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
49
        # preserved into the next lock, which is an implicit read
50
        # lock around the get_root_id call.
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
51
        self.assertEqual(root_id, tree.get_root_id())
1986.5.2 by Robert Collins
``WorkingTree.set_root_id(None)`` is now deprecated. Please
52
        # and if we get a new working tree instance, then the value
53
        # should still be retained
54
        tree = tree.bzrdir.open_workingtree()
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
55
        self.assertEqual(root_id, tree.get_root_id())