/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.358.2 by Jelmer Vernooij
Refresh copyright headers, add my email.
1
# Copyright (C) 2010-2018 Jelmer Vernooij <jelmer@jelmer.uk>
0.262.1 by Jelmer Vernooij
Fix WorkingTree.conflicts().
2
# Copyright (C) 2011 Canonical Ltd.
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
0.358.1 by Jelmer Vernooij
Fix FSF address.
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0.262.1 by Jelmer Vernooij
Fix WorkingTree.conflicts().
17
18
"""Tests for Git working trees."""
19
0.358.3 by Jelmer Vernooij
Enable absolute import.
20
from __future__ import absolute_import
21
0.369.2 by Jelmer Vernooij
Fix tests.
22
from .... import conflicts as _mod_conflicts
0.369.1 by Jelmer Vernooij
Implement conflict handling.
23
from ..workingtree import (
24
    FLAG_STAGEMASK,
0.262.1 by Jelmer Vernooij
Fix WorkingTree.conflicts().
25
    )
0.200.1642 by Jelmer Vernooij
Use relative imports in tests.
26
from ....tests import TestCaseWithTransport
0.262.1 by Jelmer Vernooij
Fix WorkingTree.conflicts().
27
28
29
class GitWorkingTreeTests(TestCaseWithTransport):
30
31
    def setUp(self):
32
        super(GitWorkingTreeTests, self).setUp()
33
        self.tree = self.make_branch_and_tree('.', format="git")
34
0.369.1 by Jelmer Vernooij
Implement conflict handling.
35
    def test_conflict_list(self):
0.369.2 by Jelmer Vernooij
Fix tests.
36
        self.assertIsInstance(
37
                self.tree.conflicts(),
38
                _mod_conflicts.ConflictList)
0.369.1 by Jelmer Vernooij
Implement conflict handling.
39
40
    def test_add_conflict(self):
41
        self.build_tree(['conflicted'])
42
        self.tree.add(['conflicted'])
43
        with self.tree.lock_tree_write():
44
            self.tree.index['conflicted'] = self.tree.index['conflicted'][:9] + (FLAG_STAGEMASK, )
45
        conflicts = self.tree.conflicts()
46
        self.assertEqual(1, len(conflicts))