~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Black-box tests for bzr push."""
98
98
        out, err = self.run_bzr('push')
99
99
        path = branch_a.get_push_location()
100
100
        self.assertEquals(out,
101
 
                          'Using saved push location: %s\n' 
102
 
                          'Pushed up to revision 2.\n'
 
101
                          'Using saved push location: %s\n'
103
102
                          % local_path_from_url(path))
104
103
        self.assertEqual(err,
105
 
                         'All changes applied successfully.\n')
 
104
                         'All changes applied successfully.\n'
 
105
                         'Pushed up to revision 2.\n')
106
106
        self.assertEqual(path,
107
107
                         branch_b.bzrdir.root_transport.base)
108
108
        # test explicit --remember
109
109
        self.run_bzr('push ../branch_c --remember')
110
110
        self.assertEquals(branch_a.get_push_location(),
111
111
                          branch_c.bzrdir.root_transport.base)
112
 
    
 
112
 
113
113
    def test_push_without_tree(self):
114
114
        # bzr push from a branch that does not have a checkout should work.
115
115
        b = self.make_branch('.')
120
120
        self.assertEndsWith(b2.base, 'pushed-location/')
121
121
 
122
122
    def test_push_new_branch_revision_count(self):
123
 
        # bzr push of a branch with revisions to a new location 
124
 
        # should print the number of revisions equal to the length of the 
 
123
        # bzr push of a branch with revisions to a new location
 
124
        # should print the number of revisions equal to the length of the
125
125
        # local branch.
126
126
        t = self.make_branch_and_tree('tree')
127
127
        self.build_tree(['tree/file'])
186
186
                message='first commit')
187
187
        self.run_bzr('push -d from to-one')
188
188
        self.failUnlessExists('to-one')
189
 
        self.run_bzr('push -d %s %s' 
 
189
        self.run_bzr('push -d %s %s'
190
190
            % tuple(map(urlutils.local_path_to_url, ['from', 'to-two'])))
191
191
        self.failUnlessExists('to-two')
192
192
 
196
196
        t.commit(allow_pointless=True, message='first commit')
197
197
        self.reset_smart_call_log()
198
198
        self.run_bzr(['push', self.get_url('to-one')], working_dir='from')
199
 
        rpc_count = len(self.hpss_calls)
200
199
        # This figure represent the amount of work to perform this use case. It
201
200
        # is entirely ok to reduce this number if a test fails due to rpc_count
202
201
        # being too low. If rpc_count increases, more network roundtrips have
203
202
        # become necessary for this use case. Please do not adjust this number
204
203
        # upwards without agreement from bzr's network support maintainers.
205
 
        self.assertEqual(61, rpc_count)
 
204
        self.assertLength(20, self.hpss_calls)
206
205
 
207
206
    def test_push_smart_stacked_streaming_acceptance(self):
208
207
        self.setup_smart_server_with_call_log()
213
212
        self.reset_smart_call_log()
214
213
        self.run_bzr(['push', '--stacked', '--stacked-on', '../parent',
215
214
            self.get_url('public')], working_dir='local')
216
 
        rpc_count = len(self.hpss_calls)
217
215
        # This figure represent the amount of work to perform this use case. It
218
216
        # is entirely ok to reduce this number if a test fails due to rpc_count
219
217
        # being too low. If rpc_count increases, more network roundtrips have
220
218
        # become necessary for this use case. Please do not adjust this number
221
219
        # upwards without agreement from bzr's network support maintainers.
222
 
        self.assertEqual(101, rpc_count)
 
220
        self.assertLength(42, self.hpss_calls)
223
221
        remote = Branch.open('public')
224
222
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
225
223
 
394
392
        self.assertContainsRe(err,
395
393
                              'Using default stacking branch stack_on at .*')
396
394
 
 
395
    def test_push_stacks_with_default_stacking_if_target_is_stackable(self):
 
396
        self.make_branch('stack_on', format='1.6')
 
397
        self.make_bzrdir('.').get_config().set_default_stack_on('stack_on')
 
398
        self.make_branch('from', format='pack-0.92')
 
399
        out, err = self.run_bzr('push -d from to')
 
400
        branch = Branch.open('to')
 
401
        self.assertEqual('../stack_on', branch.get_stacked_on_url())
 
402
 
 
403
    def test_push_does_not_change_format_with_default_if_target_cannot(self):
 
404
        self.make_branch('stack_on', format='pack-0.92')
 
405
        self.make_bzrdir('.').get_config().set_default_stack_on('stack_on')
 
406
        self.make_branch('from', format='pack-0.92')
 
407
        out, err = self.run_bzr('push -d from to')
 
408
        branch = Branch.open('to')
 
409
        self.assertRaises(errors.UnstackableBranchFormat,
 
410
            branch.get_stacked_on_url)
 
411
 
397
412
    def test_push_doesnt_create_broken_branch(self):
398
413
        """Pushing a new standalone branch works even when there's a default
399
414
        stacking policy at the destination.