/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_conflicts.py

  • Committer: Aaron Bentley
  • Date: 2007-01-17 15:39:21 UTC
  • mfrom: (1551.9.35 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 2239.
  • Revision ID: abentley@panoramicfeedback.com-20070117153921-6pp9ssa2r8n5izoo
Merge bzr.ab, to avoid conflicts submitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
2
 
 
 
1
# Copyright (C) 2005 Canonical Ltd
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
18
import os
19
19
 
 
20
from bzrlib import bzrdir
20
21
from bzrlib.tests import TestCaseWithTransport, TestCase
21
22
from bzrlib.branch import Branch
22
 
from bzrlib.conflicts import *
 
23
from bzrlib.conflicts import (MissingParent, ContentsConflict, TextConflict,
 
24
        PathConflict, DuplicateID, DuplicateEntry, ParentLoop, UnversionedParent,
 
25
        ConflictList, 
 
26
        restore)
23
27
from bzrlib.errors import NotConflicted
24
28
 
25
29
 
26
30
# TODO: Test commit with some added, and added-but-missing files
27
31
# RBC 20060124 is that not tested in test_commit.py ?
28
32
 
 
33
# The order of 'path' here is important - do not let it
 
34
# be a sorted list.
29
35
example_conflicts = ConflictList([ 
 
36
    MissingParent('Not deleting', 'pathg', 'idg'),
30
37
    ContentsConflict('patha', 'ida'), 
31
38
    TextConflict('patha'),
32
39
    PathConflict('pathb', 'pathc', 'idb'),
35
42
                   None),
36
43
    ParentLoop('Cancelled move', 'pathe', 'path2e', None, 'id2e'),
37
44
    UnversionedParent('Versioned directory', 'pathf', 'idf'),
38
 
    MissingParent('Not deleting', 'pathg', 'idg'),
39
45
])
40
46
 
41
47
 
43
49
 
44
50
    def test_conflicts(self):
45
51
        """Conflicts are detected properly"""
46
 
        tree = self.make_branch_and_tree('.')
 
52
        tree = self.make_branch_and_tree('.',
 
53
            format=bzrdir.BzrDirFormat6())
47
54
        b = tree.branch
48
55
        file('hello', 'w').write('hello world4')
49
56
        file('hello.THIS', 'w').write('hello world2')
77
84
 
78
85
 
79
86
class TestConflictStanzas(TestCase):
 
87
 
80
88
    def test_stanza_roundtrip(self):
 
89
        # write and read our example stanza.
81
90
        stanza_iter = example_conflicts.to_stanzas()
82
91
        processed = ConflictList.from_stanzas(stanza_iter)
83
92
        for o,p in zip(processed, example_conflicts):