~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: John Arbash Meinel
  • Date: 2009-08-25 18:45:40 UTC
  • mto: (4634.6.15 2.0)
  • mto: This revision was merged to the branch mainline in revision 4667.
  • Revision ID: john@arbash-meinel.com-20090825184540-6dn3xjq62xhgj2gq
Add support for skipping ghost nodes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
import os
20
20
from bzrlib import bzrdir
21
21
from bzrlib.tests import TestCaseWithTransport, TestCase
22
22
from bzrlib.branch import Branch
23
 
from bzrlib.conflicts import (MissingParent, ContentsConflict, TextConflict,
24
 
        PathConflict, DuplicateID, DuplicateEntry, ParentLoop, UnversionedParent,
25
 
        ConflictList, 
26
 
        restore)
 
23
from bzrlib.conflicts import (
 
24
    ConflictList,
 
25
    ContentsConflict,
 
26
    DuplicateID,
 
27
    DuplicateEntry,
 
28
    MissingParent,
 
29
    NonDirectoryParent,
 
30
    ParentLoop,
 
31
    PathConflict,
 
32
    TextConflict,
 
33
    UnversionedParent,
 
34
    resolve,
 
35
    restore,
 
36
    )
27
37
from bzrlib.errors import NotConflicted
28
38
 
29
39
 
35
45
# u'\xe5' == a with circle
36
46
# '\xc3\xae' == u'\xee' == i with hat
37
47
# So these are u'pathg' and 'idg' only with a circle and a hat. (shappo?)
38
 
example_conflicts = ConflictList([ 
 
48
example_conflicts = ConflictList([
39
49
    MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
40
 
    ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'), 
 
50
    ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),
41
51
    TextConflict(u'p\xe5tha'),
42
52
    PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
43
53
    DuplicateID('Unversioned existing file', u'p\xe5thc', u'p\xe5thc2',
47
57
    ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
48
58
               None, '\xc3\xaed2e'),
49
59
    UnversionedParent('Versioned directory', u'p\xe5thf', '\xc3\xaedf'),
 
60
    NonDirectoryParent('Created directory', u'p\xe5thg', '\xc3\xaedg'),
50
61
])
51
62
 
52
63
 
74
85
        restore('hello.sploo')
75
86
        self.assertEqual(len(tree.conflicts()), 0)
76
87
        self.assertFileEqual('hello world2', 'hello')
77
 
        assert not os.path.lexists('hello.sploo')
 
88
        self.assertFalse(os.path.lexists('hello.sploo'))
78
89
        self.assertRaises(NotConflicted, restore, 'hello')
79
90
        self.assertRaises(NotConflicted, restore, 'hello.sploo')
80
91
 
115
126
                         tree_conflicts.select_conflicts(tree, ['foo'],
116
127
                                                         ignore_misses=True))
117
128
 
 
129
    def test_resolve_conflicts_recursive(self):
 
130
        tree = self.make_branch_and_tree('.')
 
131
        self.build_tree(['dir/', 'dir/hello'])
 
132
        tree.add(['dir', 'dir/hello'])
 
133
        tree.set_conflicts(ConflictList([TextConflict('dir/hello')]))
 
134
        resolve(tree, ['dir'], recursive=False, ignore_misses=True)
 
135
        self.assertEqual(ConflictList([TextConflict('dir/hello')]),
 
136
                         tree.conflicts())
 
137
        resolve(tree, ['dir'], recursive=True, ignore_misses=True)
 
138
        self.assertEqual(ConflictList([]),
 
139
                         tree.conflicts())
 
140
 
118
141
 
119
142
class TestConflictStanzas(TestCase):
120
143