~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: 2012-02-14 18:29:43 UTC
  • mfrom: (6404.6.11 cached-branch-store)
  • Revision ID: pqm@pqm.ubuntu.com-20120214182943-vso6j0mqdnxfkp7s
(vila) Cache the branch config store to avoid useless IOs. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2012 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
117
117
        self.assertEquals(out,
118
118
                ('','bzr: ERROR: These branches have diverged.  '
119
119
                 'See "bzr help diverged-branches" for more information.\n'))
 
120
        # Refresh the branch as 'push' modified it
 
121
        branch_a = branch_a.bzrdir.open_branch()
120
122
        self.assertEquals(osutils.abspath(branch_a.get_push_location()),
121
123
                          osutils.abspath(branch_b.bzrdir.root_transport.base))
122
124
 
124
126
        uncommit.uncommit(branch=branch_b, tree=tree_b)
125
127
        transport.delete('branch_b/c')
126
128
        out, err = self.run_bzr('push', working_dir='branch_a')
 
129
        # Refresh the branch as 'push' modified it
 
130
        branch_a = branch_a.bzrdir.open_branch()
127
131
        path = branch_a.get_push_location()
128
132
        self.assertEqual(err,
129
133
                         'Using saved push location: %s\n'
134
138
                         branch_b.bzrdir.root_transport.base)
135
139
        # test explicit --remember
136
140
        self.run_bzr('push ../branch_c --remember', working_dir='branch_a')
 
141
        # Refresh the branch as 'push' modified it
 
142
        branch_a = branch_a.bzrdir.open_branch()
137
143
        self.assertEquals(branch_a.get_push_location(),
138
144
                          branch_c.bzrdir.root_transport.base)
139
145
 
176
182
        t.add('file')
177
183
        t.commit('commit 1')
178
184
        self.run_bzr('push -d tree pushed-to')
179
 
        path = t.branch.get_push_location()
 
185
        # Refresh the branch as 'push' modified it and get the push location
 
186
        push_loc = t.branch.bzrdir.open_branch().get_push_location()
180
187
        out, err = self.run_bzr('push', working_dir="tree")
181
188
        self.assertEqual('Using saved push location: %s\n'
182
189
                         'No new revisions or tags to push.\n' %
183
 
                         urlutils.local_path_from_url(path), err)
 
190
                         urlutils.local_path_from_url(push_loc), err)
184
191
        out, err = self.run_bzr('push -q', working_dir="tree")
185
192
        self.assertEqual('', out)
186
193
        self.assertEqual('', err)
285
292
        # being too low. If rpc_count increases, more network roundtrips have
286
293
        # become necessary for this use case. Please do not adjust this number
287
294
        # upwards without agreement from bzr's network support maintainers.
288
 
        self.assertLength(14, self.hpss_calls)
 
295
        self.assertLength(15, self.hpss_calls)
289
296
        self.assertLength(1, self.hpss_connections)
290
297
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
291
298
        remote = branch.Branch.open('public')
506
513
        trunk_public = self.make_branch('public_trunk', format='1.9')
507
514
        trunk_public.pull(trunk_tree.branch)
508
515
        trunk_public_url = self.get_readonly_url('public_trunk')
509
 
        trunk_tree.branch.set_public_branch(trunk_public_url)
 
516
        br = trunk_tree.branch
 
517
        br.set_public_branch(trunk_public_url)
510
518
        # now we do a stacked push, which should determine the public location
511
519
        # for us.
512
520
        out, err = self.run_bzr(['push', '--stacked',
703
711
        self.tree.commit('modify file', rev_id='modified')
704
712
 
705
713
    def set_config_push_strict(self, value):
706
 
        # set config var (any of bazaar.conf, locations.conf, branch.conf
707
 
        # should do)
708
 
        conf = self.tree.branch.get_config_stack()
709
 
        conf.set('push_strict', value)
 
714
        br = branch.Branch.open('local')
 
715
        br.get_config_stack().set('push_strict', value)
710
716
 
711
717
    _default_command = ['push', '../to']
712
718
    _default_wd = 'local'