~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_resolve.py

  • Committer: Andrew Bennetts
  • Date: 2010-11-22 03:35:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5547.
  • Revision ID: andrew.bennetts@canonical.com-20101122033524-ouxj0onm3gtkimx3
Remove RepositoryFormatCHK1 and RepositoryFormatCHK2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2010 Canonical Ltd
2
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
36
36
Path conflict: mydir3 / mydir2
37
37
Text conflict in myfile
38
38
$ bzr resolve myfile
39
 
2>1 conflict resolved, 2 remaining
 
39
2>1 conflict(s) resolved, 2 remaining
40
40
$ bzr resolve my_other_file
41
 
2>1 conflict resolved, 1 remaining
 
41
2>1 conflict(s) resolved, 1 remaining
42
42
$ bzr resolve mydir2
43
 
2>1 conflict resolved, 0 remaining
 
43
2>1 conflict(s) resolved, 0 remaining
44
44
""")
45
45
 
46
46
    def test_resolve_all(self):
47
47
        self.run_script("""\
48
48
$ cd branch
49
49
$ bzr resolve --all
50
 
2>3 conflicts resolved, 0 remaining
 
50
2>3 conflict(s) resolved, 0 remaining
51
51
$ bzr conflicts
52
52
""")
53
53
 
56
56
$ mkdir branch/subdir
57
57
$ cd branch/subdir
58
58
$ bzr resolve ../myfile
59
 
2>1 conflict resolved, 2 remaining
 
59
2>1 conflict(s) resolved, 2 remaining
60
60
""")
61
61
 
62
62
    def test_resolve_via_directory_option(self):
63
63
        self.run_script("""\
64
64
$ bzr resolve -d branch myfile
65
 
2>1 conflict resolved, 2 remaining
 
65
2>1 conflict(s) resolved, 2 remaining
66
66
""")
67
67
 
68
68
    def test_resolve_all_via_directory_option(self):
69
69
        self.run_script("""\
70
70
$ bzr resolve -d branch --all
71
 
2>3 conflicts resolved, 0 remaining
 
71
2>3 conflict(s) resolved, 0 remaining
72
72
$ bzr conflicts -d branch
73
73
""")
74
74
 
75
75
 
76
 
class TestBug788000(script.TestCaseWithTransportAndScript):
77
 
 
78
 
    def test_bug_788000(self):
79
 
        self.run_script('''\
80
 
$ bzr init a
81
 
$ mkdir a/dir
82
 
$ echo foo > a/dir/file
83
 
$ bzr add a/dir
84
 
$ cd a
85
 
$ bzr commit -m one
86
 
$ cd ..
87
 
$ bzr clone a b
88
 
$ echo bar > b/dir/file
89
 
$ cd a
90
 
$ rm -r dir
91
 
$ bzr commit -m two
92
 
$ cd ../b
93
 
''',
94
 
                        null_output_matches_anything=True)
95
 
 
96
 
        self.run_script('''\
97
 
$ bzr pull
98
 
Using saved parent location:...
99
 
Now on revision 2.
100
 
2>RM  dir/file => dir/file.THIS
101
 
2>Conflict: can't delete dir because it is not empty.  Not deleting.
102
 
2>Conflict because dir is not versioned, but has versioned children...
103
 
2>Contents conflict in dir/file
104
 
2>3 conflicts encountered.
105
 
''')
106
 
        self.run_script('''\
107
 
$ bzr resolve --take-other
108
 
2>deleted dir/file.THIS
109
 
2>deleted dir
110
 
2>3 conflicts resolved, 0 remaining
111
 
''')
112
 
 
113
 
 
114
76
class TestResolveAuto(tests.TestCaseWithTransport):
115
77
 
116
78
    def test_auto_resolve(self):
123
85
        file_conflict = conflicts.TextConflict('file', file_id='file_id')
124
86
        tree.set_conflicts(conflicts.ConflictList([file_conflict]))
125
87
        note = self.run_bzr('resolve', retcode=1, working_dir='tree')[1]
126
 
        self.assertContainsRe(note, '0 conflicts auto-resolved.')
 
88
        self.assertContainsRe(note, '0 conflict\\(s\\) auto-resolved.')
127
89
        self.assertContainsRe(note,
128
90
            'Remaining conflicts:\nText conflict in file')
129
91
        self.build_tree_contents([('tree/file', 'a\n')])
130
92
        note = self.run_bzr('resolve', working_dir='tree')[1]
131
93
        self.assertContainsRe(note, 'All conflicts resolved.')
 
94
 
 
95
 
 
96
class TestResolveSilentlyIgnore(script.TestCaseWithTransportAndScript):
 
97
 
 
98
    def test_bug_646961(self):
 
99
        self.run_script("""\
 
100
            $ bzr init base
 
101
            Created a standalone tree (format: 2a)
 
102
            $ cd base
 
103
            $ echo >file1
 
104
            $ bzr add
 
105
            adding file1
 
106
            $ bzr ci -m "stuff"
 
107
            2>Committing to: .../base/
 
108
            2>added file1
 
109
            2>Committed revision 1.
 
110
            $ cd ..
 
111
            $ bzr branch base branch
 
112
            2>Branched 1 revision(s).
 
113
            $ cd base
 
114
            $ echo "1" >> file1
 
115
            $ bzr ci -m "branch 1"
 
116
            2>Committing to: .../base/
 
117
            2>modified file1
 
118
            2>Committed revision 2.
 
119
            $ cd ../branch
 
120
            $ echo "2" >> file1
 
121
            $ bzr ci -m "branch 2"
 
122
            2>Committing to: .../branch/
 
123
            2>modified file1
 
124
            2>Committed revision 2.
 
125
            $ cd ../base
 
126
            $ bzr merge ../branch
 
127
            2> M  file1
 
128
            2>Text conflict in file1
 
129
            2>1 conflicts encountered.
 
130
            # The following succeeds silently without resolving the conflict
 
131
            $ bzr resolve file1 --take-other
 
132
            2>0 conflict(s) resolved, 1 remaining
 
133
            # The following wil fail when --take-other is implemented
 
134
            # for text conflicts
 
135
            $ bzr conflicts
 
136
            Text conflict in file1
 
137
            """)
 
138