~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-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
65
65
 
66
66
        # If there is no parent location set, :parent isn't mentioned.
67
67
        out = self.run_bzr('push', working_dir='a', retcode=3)
68
 
        self.assertEquals(out,
 
68
        self.assertEqual(out,
69
69
                ('','bzr: ERROR: No push location known or specified.\n'))
70
70
 
71
71
        # If there is a parent location set, the error suggests :parent.
72
72
        tree_a.branch.set_parent(tree_b.branch.base)
73
73
        out = self.run_bzr('push', working_dir='a', retcode=3)
74
 
        self.assertEquals(out,
 
74
        self.assertEqual(out,
75
75
            ('','bzr: ERROR: No push location known or specified. '
76
76
                'To push to the parent branch '
77
77
                '(at %s), use \'bzr push :parent\'.\n' %
100
100
 
101
101
        # test push for failure without push location set
102
102
        out = self.run_bzr('push', working_dir='branch_a', retcode=3)
103
 
        self.assertEquals(out,
 
103
        self.assertEqual(out,
104
104
                ('','bzr: ERROR: No push location known or specified.\n'))
105
105
 
106
106
        # test not remembered if cannot actually push
107
107
        self.run_bzr('push path/which/doesnt/exist',
108
108
                     working_dir='branch_a', retcode=3)
109
109
        out = self.run_bzr('push', working_dir='branch_a', retcode=3)
110
 
        self.assertEquals(
 
110
        self.assertEqual(
111
111
                ('', 'bzr: ERROR: No push location known or specified.\n'),
112
112
                out)
113
113
 
114
114
        # test implicit --remember when no push location set, push fails
115
115
        out = self.run_bzr('push ../branch_b',
116
116
                           working_dir='branch_a', retcode=3)
117
 
        self.assertEquals(out,
 
117
        self.assertEqual(out,
118
118
                ('','bzr: ERROR: These branches have diverged.  '
119
119
                 'See "bzr help diverged-branches" for more information.\n'))
120
120
        # Refresh the branch as 'push' modified it
121
121
        branch_a = branch_a.bzrdir.open_branch()
122
 
        self.assertEquals(osutils.abspath(branch_a.get_push_location()),
 
122
        self.assertEqual(osutils.abspath(branch_a.get_push_location()),
123
123
                          osutils.abspath(branch_b.bzrdir.root_transport.base))
124
124
 
125
125
        # test implicit --remember after resolving previous failure
140
140
        self.run_bzr('push ../branch_c --remember', working_dir='branch_a')
141
141
        # Refresh the branch as 'push' modified it
142
142
        branch_a = branch_a.bzrdir.open_branch()
143
 
        self.assertEquals(branch_a.get_push_location(),
 
143
        self.assertEqual(branch_a.get_push_location(),
144
144
                          branch_c.bzrdir.root_transport.base)
145
145
 
146
146
    def test_push_without_tree(self):
623
623
        to_tree.branch.tags.set_tag("mytag", "anotherrevid")
624
624
        revid1 = to_tree.commit('my commit')
625
625
        out = self.run_bzr(['push', '-d', 'from', 'to'])
626
 
        self.assertEquals(out,
 
626
        self.assertEqual(out,
627
627
            ('Conflicting tags:\n    mytag\n', 'No new revisions to push.\n'))
628
628
        out = self.run_bzr(['push', '-d', 'from', '--overwrite-tags', 'to'])
629
 
        self.assertEquals(out, ('', '1 tag updated.\n'))
630
 
        self.assertEquals(to_tree.branch.tags.lookup_tag('mytag'),
 
629
        self.assertEqual(out, ('', '1 tag updated.\n'))
 
630
        self.assertEqual(to_tree.branch.tags.lookup_tag('mytag'),
631
631
                          'somerevid')
632
 
        self.assertEquals(to_tree.branch.last_revision(), revid1)
 
632
        self.assertEqual(to_tree.branch.last_revision(), revid1)
633
633
 
634
634
 
635
635
class RedirectingMemoryTransport(memory.MemoryTransport):
892
892
        target_branch = self.make_dummy_builder('dp').get_branch()
893
893
        source_tree = self.make_branch_and_tree("dc")
894
894
        output, error = self.run_bzr("push -d dc dp", retcode=3)
895
 
        self.assertEquals("", output)
896
 
        self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
 
895
        self.assertEqual("", output)
 
896
        self.assertEqual(error, "bzr: ERROR: It is not possible to losslessly"
897
897
            " push to dummy. You may want to use dpush instead.\n")
898
898
 
899
899