/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 breezy/tests/blackbox/test_missing.py

  • Committer: Breezy landing bot
  • Author(s): Colin Watson
  • Date: 2020-11-16 21:47:08 UTC
  • mfrom: (7521.1.1 remove-lp-workaround)
  • Revision ID: breezy.the.bot@gmail.com-20201116214708-jos209mgxi41oy15
Remove breezy.git workaround for bazaar.launchpad.net.

Merged from https://code.launchpad.net/~cjwatson/brz/remove-lp-workaround/+merge/393710

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2016 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Black-box tests for bzr missing."""
 
17
"""Black-box tests for brz missing."""
18
18
 
19
 
from bzrlib import (
 
19
from breezy import (
20
20
    osutils,
21
21
    tests,
22
22
    )
38
38
        # XXX: This still needs a test that missing is quiet when there are
39
39
        # missing revisions.
40
40
        a_tree = self.make_branch_and_tree('.')
41
 
        self.build_tree_contents([('a', 'initial\n')])
 
41
        self.build_tree_contents([('a', b'initial\n')])
42
42
        a_tree.add('a')
43
43
        a_tree.commit(message='initial')
44
44
 
52
52
 
53
53
        # create a source branch
54
54
        a_tree = self.make_branch_and_tree('a')
55
 
        self.build_tree_contents([('a/a', 'initial\n')])
 
55
        self.build_tree_contents([('a/a', b'initial\n')])
56
56
        a_tree.add('a')
57
57
        a_tree.commit(message='initial')
58
58
 
59
59
        # clone and add a differing revision
60
 
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
61
 
        self.build_tree_contents([('b/a', 'initial\nmore\n')])
 
60
        b_tree = a_tree.controldir.sprout('b').open_workingtree()
 
61
        self.build_tree_contents([('b/a', b'initial\nmore\n')])
62
62
        b_tree.commit(message='more')
63
63
 
64
64
        def run_missing(args, retcode=1, working_dir=None):
138
138
        lines7 = run_missing_a(['--show-ids'])
139
139
        self.assertLength(11, lines7)
140
140
 
141
 
        lines8 =  run_missing_a(['--verbose'])
 
141
        lines8 = run_missing_a(['--verbose'])
142
142
        self.assertEqual("modified:", lines8[-2])
143
143
        self.assertEqual("  a", lines8[-1])
144
144
 
155
155
        self.assertEqualDiff('This branch has no new revisions.',
156
156
                             run_missing_a(['--mine-only'], retcode=0)[0])
157
157
        self.assertEqualDiff('Other branch has no new revisions.',
158
 
                              run_missing_a(['--theirs-only'], retcode=0)[0])
 
158
                             run_missing_a(['--theirs-only'], retcode=0)[0])
159
159
 
160
160
    def test_missing_filtered(self):
161
161
        # create a source branch
162
162
        a_tree = self.make_branch_and_tree('a')
163
 
        self.build_tree_contents([('a/a', 'initial\n')])
 
163
        self.build_tree_contents([('a/a', b'initial\n')])
164
164
        a_tree.add('a')
165
165
        a_tree.commit(message='r1')
166
166
        # clone and add differing revisions
167
 
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
 
167
        b_tree = a_tree.controldir.sprout('b').open_workingtree()
168
168
 
169
169
        for i in range(2, 6):
170
170
            a_tree.commit(message='a%d' % i)
171
171
            b_tree.commit(message='b%d' % i)
172
172
 
173
173
        # local
174
 
        out,err = self.run_bzr('missing ../b --my-revision 3',
175
 
                               retcode=1, working_dir='a')
 
174
        out, err = self.run_bzr('missing ../b --my-revision 3',
 
175
                                retcode=1, working_dir='a')
176
176
        self.assertMessages(out, ('a3', 'b2', 'b3', 'b4', 'b5'), ('a2', 'a4'))
177
177
 
178
 
        out,err = self.run_bzr('missing ../b --my-revision 3..4',
179
 
                               retcode=1, working_dir='a')
 
178
        out, err = self.run_bzr('missing ../b --my-revision 3..4',
 
179
                                retcode=1, working_dir='a')
180
180
        self.assertMessages(out, ('a3', 'a4'), ('a2', 'a5'))
181
181
 
182
 
        #remote
183
 
        out,err = self.run_bzr('missing ../b -r 3',
184
 
                               retcode=1, working_dir='a')
 
182
        # remote
 
183
        out, err = self.run_bzr('missing ../b -r 3',
 
184
                                retcode=1, working_dir='a')
185
185
        self.assertMessages(out, ('a2', 'a3', 'a4', 'a5', 'b3'), ('b2', 'b4'))
186
186
 
187
 
        out,err = self.run_bzr('missing ../b -r 3..4',
188
 
                               retcode=1, working_dir='a')
 
187
        out, err = self.run_bzr('missing ../b -r 3..4',
 
188
                                retcode=1, working_dir='a')
189
189
        self.assertMessages(out, ('b3', 'b4'), ('b2', 'b5'))
190
190
 
191
 
        #both
192
 
        out,err = self.run_bzr('missing ../b --my-revision 3..4 -r 3..4',
193
 
                               retcode=1, working_dir='a')
 
191
        # both
 
192
        out, err = self.run_bzr('missing ../b --my-revision 3..4 -r 3..4',
 
193
                                retcode=1, working_dir='a')
194
194
        self.assertMessages(out, ('a3', 'a4', 'b3', 'b4'),
195
 
            ('a2', 'a5', 'b2', 'b5'))
 
195
                            ('a2', 'a5', 'b2', 'b5'))
196
196
 
197
197
    def test_missing_check_last_location(self):
198
198
        # check that last location shown as filepath not file URL
207
207
        location = osutils.getcwd() + '/a/'
208
208
 
209
209
        # clone
210
 
        b.bzrdir.sprout('b')
 
210
        b.controldir.sprout('b')
211
211
 
212
212
        # check last location
213
213
        lines, err = self.run_bzr('missing', working_dir='b')
214
 
        self.assertEquals('Using saved parent location: %s\n'
215
 
                          'Branches are up to date.\n' % location,
216
 
                          lines)
217
 
        self.assertEquals('', err)
 
214
        self.assertEqual('Using saved parent location: %s\n'
 
215
                         'Branches are up to date.\n' % location,
 
216
                         lines)
 
217
        self.assertEqual('', err)
218
218
 
219
219
    def test_missing_directory(self):
220
220
        """Test --directory option"""
221
221
 
222
222
        # create a source branch
223
223
        a_tree = self.make_branch_and_tree('a')
224
 
        self.build_tree_contents([('a/a', 'initial\n')])
 
224
        self.build_tree_contents([('a/a', b'initial\n')])
225
225
        a_tree.add('a')
226
226
        a_tree.commit(message='initial')
227
227
 
228
228
        # clone and add a differing revision
229
 
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
230
 
        self.build_tree_contents([('b/a', 'initial\nmore\n')])
 
229
        b_tree = a_tree.controldir.sprout('b').open_workingtree()
 
230
        self.build_tree_contents([('b/a', b'initial\nmore\n')])
231
231
        b_tree.commit(message='more')
232
232
 
233
233
        out2, err2 = self.run_bzr('missing --directory a b', retcode=1)
240
240
 
241
241
        # create a source branch
242
242
        a_tree = self.make_branch_and_tree('a')
243
 
        self.build_tree_contents([('a/a', 'initial\n')])
 
243
        self.build_tree_contents([('a/a', b'initial\n')])
244
244
        a_tree.add('a')
245
245
        a_tree.commit(message='initial')
246
246
 
247
247
        # clone and add a differing revision
248
 
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
249
 
        self.build_tree_contents([('b/a', 'initial\nmore\n')])
 
248
        b_tree = a_tree.controldir.sprout('b').open_workingtree()
 
249
        self.build_tree_contents([('b/a', b'initial\nmore\n')])
250
250
        b_tree.commit(message='more')
251
251
        b_tree.branch.tags.set_tag('a-tag', b_tree.last_revision())
252
252