~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2014-10-06 16:32:42 UTC
  • mfrom: (6597.2.4 split-diff-tests)
  • Revision ID: pqm@pqm.ubuntu.com-20141006163242-c2cll01cwc24grkk
(vila) Split some tests to be able to get finer grained failures (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
        tree_a.commit('commit b')
237
237
        # reset parent
238
238
        parent = branch_b.get_parent()
 
239
        branch_b = branch.Branch.open('branch_b')
239
240
        branch_b.set_parent(None)
240
241
        self.assertEqual(None, branch_b.get_parent())
241
242
        # test pull for failure without parent set
252
253
                ('','bzr: ERROR: These branches have diverged.'
253
254
                    ' Use the missing command to see how.\n'
254
255
                    'Use the merge command to reconcile them.\n'))
255
 
        self.assertEqual(branch_b.get_parent(), parent)
 
256
        tree_b = tree_b.bzrdir.open_workingtree()
 
257
        branch_b = tree_b.branch
 
258
        self.assertEqual(parent, branch_b.get_parent())
256
259
        # test implicit --remember after resolving previous failure
257
260
        uncommit.uncommit(branch=branch_b, tree=tree_b)
258
261
        t.delete('branch_b/d')
259
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()
260
265
        self.assertEqual(branch_b.get_parent(), parent)
261
266
        # test explicit --remember
262
267
        self.run_bzr('pull ../branch_c --remember', working_dir='branch_b')
263
 
        self.assertEqual(branch_b.get_parent(),
264
 
                          branch_c.bzrdir.root_transport.base)
 
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())
265
272
 
266
273
    def test_pull_bundle(self):
267
274
        from bzrlib.testament import Testament
360
367
    def test_pull_verbose_uses_default_log(self):
361
368
        tree = self.example_branch('source')
362
369
        target = self.make_branch_and_tree('target')
363
 
        target_config = target.branch.get_config_stack()
364
 
        target_config.set('log_format', 'short')
 
370
        target.branch.get_config_stack().set('log_format', 'short')
365
371
        out = self.run_bzr('pull -v source -d target')[0]
366
372
        self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n')
367
373
        self.assertNotContainsRe(
495
501
                             'fee>>>>>>> MERGE-SOURCE\n',
496
502
                             open(osutils.pathjoin('b', 'hello')).read())
497
503
 
498
 
    def test_pull_show_base_working_tree_only(self):
499
 
        """--show-base only allowed if there's a working tree
 
504
    def test_pull_warns_about_show_base_when_no_working_tree(self):
 
505
        """--show-base is useless if there's no working tree
500
506
 
501
 
        see https://bugs.launchpad.net/bzr/+bug/202374"""
502
 
        # create a branch, see that --show-base fails
 
507
        see https://bugs.launchpad.net/bzr/+bug/1022160"""
503
508
        self.make_branch('from')
504
509
        self.make_branch('to')
505
 
        out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
506
 
        self.assertEqual(
507
 
            out, ('','bzr: ERROR: Need working tree for --show-base.\n'))
 
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'))
508
513
 
509
514
    def test_pull_tag_conflicts(self):
510
515
        """pulling tags with conflicts will change the exit code"""
527
532
        self.assertEqual(out,
528
533
            ('1 tag(s) updated.\n', ''))
529
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.assertEquals(out,
 
544
            ('No revisions to pull.\nConflicting tags:\n    mytag\n', ''))
 
545
        out = self.run_bzr(['pull', '-d', 'to', '--overwrite-tags', 'from'])
 
546
        self.assertEquals(out, ('1 tag(s) updated.\n', ''))
 
547
 
 
548
        self.assertEquals(to_tree.branch.tags.lookup_tag('mytag'),
 
549
                          'somerevid')
 
550
        self.assertEquals(to_tree.branch.last_revision(), revid1)
 
551
 
530
552
    def test_pull_tag_overwrite(self):
531
553
        """pulling tags with --overwrite only reports changed tags."""
532
554
        # create a branch, see that --show-base fails