~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-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
21
21
import sys
22
22
 
23
23
from bzrlib import (
24
 
    branch,
25
24
    debug,
26
 
    osutils,
27
25
    remote,
28
 
    tests,
29
 
    uncommit,
30
26
    urlutils,
31
 
    workingtree,
32
27
    )
33
28
 
 
29
from bzrlib.branch import Branch
34
30
from bzrlib.directory_service import directories
35
 
from bzrlib.tests import (
36
 
    fixtures,
37
 
    script,
38
 
    )
39
 
 
40
 
 
41
 
class TestPull(tests.TestCaseWithTransport):
 
31
from bzrlib.osutils import pathjoin
 
32
from bzrlib.tests import TestCaseWithTransport
 
33
from bzrlib.uncommit import uncommit
 
34
from bzrlib.workingtree import WorkingTree
 
35
 
 
36
 
 
37
class TestPull(TestCaseWithTransport):
42
38
 
43
39
    def example_branch(self, path='.'):
44
40
        tree = self.make_branch_and_tree(path)
45
41
        self.build_tree_contents([
46
 
            (osutils.pathjoin(path, 'hello'),   'foo'),
47
 
            (osutils.pathjoin(path, 'goodbye'), 'baz')])
 
42
            (pathjoin(path, 'hello'),   'foo'),
 
43
            (pathjoin(path, 'goodbye'), 'baz')])
48
44
        tree.add('hello')
49
45
        tree.commit(message='setup')
50
46
        tree.add('goodbye')
54
50
    def test_pull(self):
55
51
        """Pull changes from one branch to another."""
56
52
        a_tree = self.example_branch('a')
57
 
        base_rev = a_tree.branch.last_revision()
58
 
        self.run_bzr('pull', retcode=3, working_dir='a')
59
 
        self.run_bzr('missing', retcode=3, working_dir='a')
60
 
        self.run_bzr('missing .', working_dir='a')
61
 
        self.run_bzr('missing', working_dir='a')
 
53
        os.chdir('a')
 
54
        self.run_bzr('pull', retcode=3)
 
55
        self.run_bzr('missing', retcode=3)
 
56
        self.run_bzr('missing .')
 
57
        self.run_bzr('missing')
62
58
        # this will work on windows because we check for the same branch
63
59
        # in pull - if it fails, it is a regression
64
 
        self.run_bzr('pull', working_dir='a')
65
 
        self.run_bzr('pull /', retcode=3, working_dir='a')
 
60
        self.run_bzr('pull')
 
61
        self.run_bzr('pull /', retcode=3)
66
62
        if sys.platform not in ('win32', 'cygwin'):
67
 
            self.run_bzr('pull', working_dir='a')
 
63
            self.run_bzr('pull')
68
64
 
 
65
        os.chdir('..')
69
66
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
70
 
        self.run_bzr('pull', working_dir='b')
71
 
        os.mkdir('b/subdir')
 
67
        os.chdir('b')
 
68
        self.run_bzr('pull')
 
69
        os.mkdir('subdir')
72
70
        b_tree.add('subdir')
73
 
        new_rev = b_tree.commit(message='blah', allow_pointless=True)
74
 
 
75
 
        a = branch.Branch.open('a')
76
 
        b = branch.Branch.open('b')
77
 
        self.assertEqual(a.last_revision(), base_rev)
78
 
        self.assertEqual(b.last_revision(), new_rev)
79
 
 
80
 
        self.run_bzr('pull ../b', working_dir='a')
81
 
        self.assertEqual(a.last_revision(), b.last_revision())
 
71
        b_tree.commit(message='blah', allow_pointless=True)
 
72
 
 
73
        os.chdir('..')
 
74
        a = Branch.open('a')
 
75
        b = Branch.open('b')
 
76
        self.assertEqual(a.revision_history(), b.revision_history()[:-1])
 
77
 
 
78
        os.chdir('a')
 
79
        self.run_bzr('pull ../b')
 
80
        self.assertEqual(a.revision_history(), b.revision_history())
82
81
        a_tree.commit(message='blah2', allow_pointless=True)
83
82
        b_tree.commit(message='blah3', allow_pointless=True)
84
83
        # no overwrite
85
 
        self.run_bzr('pull ../a', retcode=3, working_dir='b')
 
84
        os.chdir('../b')
 
85
        self.run_bzr('pull ../a', retcode=3)
 
86
        os.chdir('..')
86
87
        b_tree.bzrdir.sprout('overwriteme')
87
 
        self.run_bzr('pull --overwrite ../a', working_dir='overwriteme')
88
 
        overwritten = branch.Branch.open('overwriteme')
89
 
        self.assertEqual(overwritten.last_revision(),
90
 
                         a.last_revision())
 
88
        os.chdir('overwriteme')
 
89
        self.run_bzr('pull --overwrite ../a')
 
90
        overwritten = Branch.open('.')
 
91
        self.assertEqual(overwritten.revision_history(),
 
92
                         a.revision_history())
91
93
        a_tree.merge_from_branch(b_tree.branch)
92
94
        a_tree.commit(message="blah4", allow_pointless=True)
93
 
 
94
 
        self.run_bzr('pull ../../a', working_dir='b/subdir')
95
 
        self.assertEqual(a.last_revision(), b.last_revision())
96
 
        sub_tree = workingtree.WorkingTree.open_containing('b/subdir')[0]
 
95
        os.chdir('../b/subdir')
 
96
        self.run_bzr('pull ../../a')
 
97
        self.assertEqual(a.revision_history()[-1], b.revision_history()[-1])
 
98
        sub_tree = WorkingTree.open_containing('.')[0]
97
99
        sub_tree.commit(message="blah5", allow_pointless=True)
98
100
        sub_tree.commit(message="blah6", allow_pointless=True)
99
 
        self.run_bzr('pull ../a', working_dir='b')
 
101
        os.chdir('..')
 
102
        self.run_bzr('pull ../a')
 
103
        os.chdir('../a')
100
104
        a_tree.commit(message="blah7", allow_pointless=True)
101
105
        a_tree.merge_from_branch(b_tree.branch)
102
106
        a_tree.commit(message="blah8", allow_pointless=True)
103
 
        self.run_bzr('pull ../b', working_dir='a')
104
 
        self.run_bzr('pull ../b', working_dir='a')
 
107
        self.run_bzr('pull ../b')
 
108
        self.run_bzr('pull ../b')
105
109
 
106
110
    def test_pull_dash_d(self):
107
111
        self.example_branch('a')
127
131
 
128
132
        b_tree = a_tree.bzrdir.sprout('b',
129
133
                   revision_id=a_tree.branch.get_rev_id(1)).open_workingtree()
130
 
        self.run_bzr('pull -r 2', working_dir='b')
131
 
        a = branch.Branch.open('a')
132
 
        b = branch.Branch.open('b')
 
134
        os.chdir('b')
 
135
        self.run_bzr('pull -r 2')
 
136
        a = Branch.open('../a')
 
137
        b = Branch.open('.')
133
138
        self.assertEqual(a.revno(),4)
134
139
        self.assertEqual(b.revno(),2)
135
 
        self.run_bzr('pull -r 3', working_dir='b')
 
140
        self.run_bzr('pull -r 3')
136
141
        self.assertEqual(b.revno(),3)
137
 
        self.run_bzr('pull -r 4', working_dir='b')
138
 
        self.assertEqual(a.last_revision(), b.last_revision())
 
142
        self.run_bzr('pull -r 4')
 
143
        self.assertEqual(a.revision_history(), b.revision_history())
139
144
 
140
 
    def test_pull_tags(self):
141
 
        """Tags are updated by pull, and revisions named in those tags are
142
 
        fetched.
143
 
        """
144
 
        # Make a source, sprout a target off it
145
 
        builder = self.make_branch_builder('source')
146
 
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
147
 
        source.get_config_stack().set('branch.fetch_tags', True)
148
 
        target_bzrdir = source.bzrdir.sprout('target')
149
 
        source.tags.set_tag('tag-a', 'rev-2')
150
 
        # Pull from source
151
 
        self.run_bzr('pull -d target source')
152
 
        target = target_bzrdir.open_branch()
153
 
        # The tag is present, and so is its revision.
154
 
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
155
 
        target.repository.get_revision('rev-2')
156
145
 
157
146
    def test_overwrite_uptodate(self):
158
147
        # Make sure pull --overwrite overwrites
171
160
        self.build_tree_contents([('a/foo', 'a third change')])
172
161
        a_tree.commit(message='a third change')
173
162
 
174
 
        self.assertEqual(a_tree.branch.last_revision_info()[0], 3)
 
163
        rev_history_a = a_tree.branch.revision_history()
 
164
        self.assertEqual(len(rev_history_a), 3)
175
165
 
176
166
        b_tree.merge_from_branch(a_tree.branch)
177
167
        b_tree.commit(message='merge')
178
168
 
179
 
        self.assertEqual(b_tree.branch.last_revision_info()[0], 2)
180
 
 
181
 
        self.run_bzr('pull --overwrite ../a', working_dir='b')
182
 
        (last_revinfo_b) = b_tree.branch.last_revision_info()
183
 
        self.assertEqual(last_revinfo_b[0], 3)
184
 
        self.assertEqual(last_revinfo_b[1], a_tree.branch.last_revision())
 
169
        self.assertEqual(len(b_tree.branch.revision_history()), 2)
 
170
 
 
171
        os.chdir('b')
 
172
        self.run_bzr('pull --overwrite ../a')
 
173
        rev_history_b = b_tree.branch.revision_history()
 
174
        self.assertEqual(len(rev_history_b), 3)
 
175
 
 
176
        self.assertEqual(rev_history_b, rev_history_a)
185
177
 
186
178
    def test_overwrite_children(self):
187
179
        # Make sure pull --overwrite sets the revision-history
199
191
        self.build_tree_contents([('a/foo', 'a third change')])
200
192
        a_tree.commit(message='a third change')
201
193
 
202
 
        self.assertEqual(a_tree.branch.last_revision_info()[0], 3)
 
194
        self.assertEqual(len(a_tree.branch.revision_history()), 3)
203
195
 
204
196
        b_tree.merge_from_branch(a_tree.branch)
205
197
        b_tree.commit(message='merge')
206
198
 
207
 
        self.assertEqual(b_tree.branch.last_revision_info()[0], 2)
 
199
        self.assertEqual(len(b_tree.branch.revision_history()), 2)
208
200
 
209
201
        self.build_tree_contents([('a/foo', 'a fourth change\n')])
210
202
        a_tree.commit(message='a fourth change')
211
203
 
212
 
        rev_info_a = a_tree.branch.last_revision_info()
213
 
        self.assertEqual(rev_info_a[0], 4)
 
204
        rev_history_a = a_tree.branch.revision_history()
 
205
        self.assertEqual(len(rev_history_a), 4)
214
206
 
215
207
        # With convergence, we could just pull over the
216
208
        # new change, but with --overwrite, we want to switch our history
217
 
        self.run_bzr('pull --overwrite ../a', working_dir='b')
218
 
        rev_info_b = b_tree.branch.last_revision_info()
219
 
        self.assertEqual(rev_info_b[0], 4)
220
 
        self.assertEqual(rev_info_b, rev_info_a)
 
209
        os.chdir('b')
 
210
        self.run_bzr('pull --overwrite ../a')
 
211
        rev_history_b = b_tree.branch.revision_history()
 
212
        self.assertEqual(len(rev_history_b), 4)
 
213
 
 
214
        self.assertEqual(rev_history_b, rev_history_a)
221
215
 
222
216
    def test_pull_remember(self):
223
217
        """Pull changes from one branch to another and test parent location."""
224
 
        t = self.get_transport()
 
218
        transport = self.get_transport()
225
219
        tree_a = self.make_branch_and_tree('branch_a')
226
220
        branch_a = tree_a.branch
227
221
        self.build_tree(['branch_a/a'])
236
230
        tree_a.commit('commit b')
237
231
        # reset parent
238
232
        parent = branch_b.get_parent()
239
 
        branch_b = branch.Branch.open('branch_b')
240
233
        branch_b.set_parent(None)
241
234
        self.assertEqual(None, branch_b.get_parent())
242
235
        # test pull for failure without parent set
243
 
        out = self.run_bzr('pull', retcode=3, working_dir='branch_b')
 
236
        os.chdir('branch_b')
 
237
        out = self.run_bzr('pull', retcode=3)
244
238
        self.assertEqual(out,
245
239
                ('','bzr: ERROR: No pull location known or specified.\n'))
246
240
        # test implicit --remember when no parent set, this pull conflicts
247
 
        self.build_tree(['branch_b/d'])
 
241
        self.build_tree(['d'])
248
242
        tree_b.add('d')
249
243
        tree_b.commit('commit d')
250
 
        out = self.run_bzr('pull ../branch_a', retcode=3,
251
 
                           working_dir='branch_b')
 
244
        out = self.run_bzr('pull ../branch_a', retcode=3)
252
245
        self.assertEqual(out,
253
246
                ('','bzr: ERROR: These branches have diverged.'
254
247
                    ' Use the missing command to see how.\n'
255
248
                    'Use the merge command to reconcile them.\n'))
256
 
        tree_b = tree_b.bzrdir.open_workingtree()
257
 
        branch_b = tree_b.branch
258
 
        self.assertEqual(parent, branch_b.get_parent())
 
249
        self.assertEqual(branch_b.get_parent(), parent)
259
250
        # test implicit --remember after resolving previous failure
260
 
        uncommit.uncommit(branch=branch_b, tree=tree_b)
261
 
        t.delete('branch_b/d')
262
 
        self.run_bzr('pull', working_dir='branch_b')
263
 
        # Refresh the branch object as 'pull' modified it
264
 
        branch_b = branch_b.bzrdir.open_branch()
 
251
        uncommit(branch=branch_b, tree=tree_b)
 
252
        transport.delete('branch_b/d')
 
253
        self.run_bzr('pull')
265
254
        self.assertEqual(branch_b.get_parent(), parent)
266
255
        # test explicit --remember
267
 
        self.run_bzr('pull ../branch_c --remember', working_dir='branch_b')
268
 
        # Refresh the branch object as 'pull' modified it
269
 
        branch_b = branch_b.bzrdir.open_branch()
270
 
        self.assertEqual(branch_c.bzrdir.root_transport.base,
271
 
                         branch_b.get_parent())
 
256
        self.run_bzr('pull ../branch_c --remember')
 
257
        self.assertEqual(branch_b.get_parent(),
 
258
                          branch_c.bzrdir.root_transport.base)
272
259
 
273
260
    def test_pull_bundle(self):
274
261
        from bzrlib.testament import Testament
275
262
        # Build up 2 trees and prepare for a pull
276
263
        tree_a = self.make_branch_and_tree('branch_a')
277
 
        with open('branch_a/a', 'wb') as f:
278
 
            f.write('hello')
 
264
        f = open('branch_a/a', 'wb')
 
265
        f.write('hello')
 
266
        f.close()
279
267
        tree_a.add('a')
280
268
        tree_a.commit('message')
281
269
 
282
270
        tree_b = tree_a.bzrdir.sprout('branch_b').open_workingtree()
283
271
 
284
272
        # Make a change to 'a' that 'b' can pull
285
 
        with open('branch_a/a', 'wb') as f:
286
 
            f.write('hey there')
 
273
        f = open('branch_a/a', 'wb')
 
274
        f.write('hey there')
 
275
        f.close()
287
276
        tree_a.commit('message')
288
277
 
289
278
        # Create the bundle for 'b' to pull
290
 
        self.run_bzr('bundle ../branch_b -o ../bundle', working_dir='branch_a')
 
279
        os.chdir('branch_a')
 
280
        self.run_bzr('bundle ../branch_b -o ../bundle')
291
281
 
292
 
        out, err = self.run_bzr('pull ../bundle', working_dir='branch_b')
 
282
        os.chdir('../branch_b')
 
283
        out, err = self.run_bzr('pull ../bundle')
293
284
        self.assertEqual(out,
294
285
                         'Now on revision 2.\n')
295
286
        self.assertEqual(err,
296
287
                ' M  a\nAll changes applied successfully.\n')
297
288
 
298
 
        self.assertEqualDiff(tree_a.branch.last_revision(),
299
 
                             tree_b.branch.last_revision())
 
289
        self.assertEqualDiff(tree_a.branch.revision_history(),
 
290
                             tree_b.branch.revision_history())
300
291
 
301
292
        testament_a = Testament.from_revision(tree_a.branch.repository,
302
293
                                              tree_a.get_parent_ids()[0])
306
297
                             testament_b.as_text())
307
298
 
308
299
        # it is legal to attempt to pull an already-merged bundle
309
 
        out, err = self.run_bzr('pull ../bundle', working_dir='branch_b')
 
300
        out, err = self.run_bzr('pull ../bundle')
310
301
        self.assertEqual(err, '')
311
 
        self.assertEqual(out, 'No revisions or tags to pull.\n')
 
302
        self.assertEqual(out, 'No revisions to pull.\n')
312
303
 
313
304
    def test_pull_verbose_no_files(self):
314
305
        """Pull --verbose should not list modified files"""
367
358
    def test_pull_verbose_uses_default_log(self):
368
359
        tree = self.example_branch('source')
369
360
        target = self.make_branch_and_tree('target')
370
 
        target.branch.get_config_stack().set('log_format', 'short')
 
361
        target_config = target.branch.get_config()
 
362
        target_config.set_user_option('log_format', 'short')
371
363
        out = self.run_bzr('pull -v source -d target')[0]
372
364
        self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n')
373
365
        self.assertNotContainsRe(
374
366
            out, r'revno: 1\ncommitter: .*\nbranch nick: source')
375
367
 
376
 
    def test_pull_smart_bound_branch(self):
377
 
        self.setup_smart_server_with_call_log()
378
 
        parent = self.make_branch_and_tree('parent')
379
 
        parent.commit(message='first commit')
380
 
        child = parent.bzrdir.sprout('child').open_workingtree()
381
 
        child.commit(message='second commit')
382
 
        checkout = parent.branch.create_checkout('checkout')
383
 
        self.run_bzr(['pull', self.get_url('child')], working_dir='checkout')
384
 
 
385
368
    def test_pull_smart_stacked_streaming_acceptance(self):
386
369
        """'bzr pull -r 123' works on stacked, smart branches, even when the
387
370
        revision specified by the revno is only present in the fallback
409
392
        # being too low. If rpc_count increases, more network roundtrips have
410
393
        # become necessary for this use case. Please do not adjust this number
411
394
        # upwards without agreement from bzr's network support maintainers.
412
 
        self.assertLength(19, self.hpss_calls)
413
 
        self.assertLength(1, self.hpss_connections)
414
 
        remote = branch.Branch.open('stacked')
 
395
        self.assertLength(18, self.hpss_calls)
 
396
        remote = Branch.open('stacked')
415
397
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
416
 
 
 
398
    
417
399
    def test_pull_cross_format_warning(self):
418
400
        """You get a warning for probably slow cross-format pulls.
419
401
        """
481
463
        a_tree = self.example_branch('a')
482
464
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
483
465
 
484
 
        with open(osutils.pathjoin('a', 'hello'),'wt') as f:
485
 
            f.write('fee')
 
466
        f = open(pathjoin('a', 'hello'),'wt')
 
467
        f.write('fee')
 
468
        f.close()
486
469
        a_tree.commit('fee')
487
470
 
488
 
        with open(osutils.pathjoin('b', 'hello'),'wt') as f:
489
 
            f.write('fie')
 
471
        f = open(pathjoin('b', 'hello'),'wt')
 
472
        f.write('fie')
 
473
        f.close()
490
474
 
491
475
        out,err=self.run_bzr(['pull','-d','b','a','--show-base'])
492
476
 
493
477
        # check for message here
494
 
        self.assertEqual(
495
 
            err,
496
 
            ' M  hello\nText conflict in hello\n1 conflicts encountered.\n')
 
478
        self.assertEqual(err,
 
479
                         ' M  hello\nText conflict in hello\n1 conflicts encountered.\n')
497
480
 
498
481
        self.assertEqualDiff('<<<<<<< TREE\n'
499
482
                             'fie||||||| BASE-REVISION\n'
500
483
                             'foo=======\n'
501
484
                             'fee>>>>>>> MERGE-SOURCE\n',
502
 
                             open(osutils.pathjoin('b', 'hello')).read())
503
 
 
504
 
    def test_pull_warns_about_show_base_when_no_working_tree(self):
505
 
        """--show-base is useless if there's no working tree
506
 
 
507
 
        see https://bugs.launchpad.net/bzr/+bug/1022160"""
 
485
                             open(pathjoin('b', 'hello')).read())
 
486
 
 
487
    def test_pull_show_base_working_tree_only(self):
 
488
        """--show-base only allowed if there's a working tree
 
489
 
 
490
        see https://bugs.launchpad.net/bzr/+bug/202374"""
 
491
        # create a branch, see that --show-base fails
508
492
        self.make_branch('from')
509
493
        self.make_branch('to')
510
 
        out = self.run_bzr(['pull','-d','to','from','--show-base'])
511
 
        self.assertEqual(out, ('No revisions or tags to pull.\n',
512
 
                               'No working tree, ignoring --show-base\n'))
513
 
 
514
 
    def test_pull_tag_conflicts(self):
515
 
        """pulling tags with conflicts will change the exit code"""
516
 
        # create a branch, see that --show-base fails
517
 
        from_tree = self.make_branch_and_tree('from')
518
 
        from_tree.branch.tags.set_tag("mytag", "somerevid")
519
 
        to_tree = self.make_branch_and_tree('to')
520
 
        to_tree.branch.tags.set_tag("mytag", "anotherrevid")
521
 
        out = self.run_bzr(['pull','-d','to','from'],retcode=1)
522
 
        self.assertEqual(out,
523
 
            ('No revisions to pull.\nConflicting tags:\n    mytag\n', ''))
524
 
 
525
 
    def test_pull_tag_notification(self):
526
 
        """pulling tags with conflicts will change the exit code"""
527
 
        # create a branch, see that --show-base fails
528
 
        from_tree = self.make_branch_and_tree('from')
529
 
        from_tree.branch.tags.set_tag("mytag", "somerevid")
530
 
        to_tree = self.make_branch_and_tree('to')
531
 
        out = self.run_bzr(['pull', '-d', 'to', 'from'])
532
 
        self.assertEqual(out,
533
 
            ('1 tag(s) updated.\n', ''))
534
 
 
535
 
    def test_overwrite_tags(self):
536
 
        """--overwrite-tags only overwrites tags, not revisions."""
537
 
        from_tree = self.make_branch_and_tree('from')
538
 
        from_tree.branch.tags.set_tag("mytag", "somerevid")
539
 
        to_tree = self.make_branch_and_tree('to')
540
 
        to_tree.branch.tags.set_tag("mytag", "anotherrevid")
541
 
        revid1 = to_tree.commit('my commit')
542
 
        out = self.run_bzr(['pull', '-d', 'to', 'from'], retcode=1)
543
 
        self.assertEqual(out,
544
 
            ('No revisions to pull.\nConflicting tags:\n    mytag\n', ''))
545
 
        out = self.run_bzr(['pull', '-d', 'to', '--overwrite-tags', 'from'])
546
 
        self.assertEqual(out, ('1 tag(s) updated.\n', ''))
547
 
 
548
 
        self.assertEqual(to_tree.branch.tags.lookup_tag('mytag'),
549
 
                          'somerevid')
550
 
        self.assertEqual(to_tree.branch.last_revision(), revid1)
551
 
 
552
 
    def test_pull_tag_overwrite(self):
553
 
        """pulling tags with --overwrite only reports changed tags."""
554
 
        # create a branch, see that --show-base fails
555
 
        from_tree = self.make_branch_and_tree('from')
556
 
        from_tree.branch.tags.set_tag("mytag", "somerevid")
557
 
        to_tree = self.make_branch_and_tree('to')
558
 
        to_tree.branch.tags.set_tag("mytag", "somerevid")
559
 
        out = self.run_bzr(['pull', '--overwrite', '-d', 'to', 'from'])
560
 
        self.assertEqual(out,
561
 
            ('No revisions or tags to pull.\n', ''))
562
 
 
563
 
 
564
 
class TestPullOutput(script.TestCaseWithTransportAndScript):
565
 
 
566
 
    def test_pull_log_format(self):
567
 
        self.run_script("""
568
 
            $ bzr init trunk
569
 
            Created a standalone tree (format: 2a)
570
 
            $ cd trunk
571
 
            $ echo foo > file
572
 
            $ bzr add
573
 
            adding file
574
 
            $ bzr commit -m 'we need some foo'
575
 
            2>Committing to:...trunk/
576
 
            2>added file
577
 
            2>Committed revision 1.
578
 
            $ cd ..
579
 
            $ bzr init feature
580
 
            Created a standalone tree (format: 2a)
581
 
            $ cd feature
582
 
            $ bzr pull -v ../trunk -Olog_format=line
583
 
            Now on revision 1.
584
 
            Added Revisions:
585
 
            1: jrandom@example.com ...we need some foo
586
 
            2>+N  file
587
 
            2>All changes applied successfully.
588
 
            """)
 
494
        out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
 
495
        self.assertEqual(out,
 
496
                         ('','bzr: ERROR: Need working tree for --show-base.\n'))
 
497
 
 
498