/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-06-10 02:51:23 UTC
  • mfrom: (4423 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4464.
  • Revision ID: mbp@sourcefrog.net-20090610025123-2u0c0ng5jcezjzqh
merge trunk

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 branch."""
159
159
        """Branching a stacked branch is not stacked by default"""
160
160
        # We have a mainline
161
161
        trunk_tree = self.make_branch_and_tree('target',
162
 
            format='development')
 
162
            format='1.9')
163
163
        trunk_tree.commit('mainline')
164
164
        # and a branch from it which is stacked
165
165
        branch_tree = self.make_branch_and_tree('branch',
166
 
            format='development')
 
166
            format='1.9')
167
167
        branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
168
168
        # with some work on it
169
169
        branch_tree.commit('moar work plz')
183
183
        """Asking to stack on a stacked branch does work"""
184
184
        # We have a mainline
185
185
        trunk_tree = self.make_branch_and_tree('target',
186
 
            format='development')
 
186
            format='1.9')
187
187
        trunk_revid = trunk_tree.commit('mainline')
188
188
        # and a branch from it which is stacked
189
189
        branch_tree = self.make_branch_and_tree('branch',
190
 
            format='development')
 
190
            format='1.9')
191
191
        branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
192
192
        # with some work on it
193
193
        branch_revid = branch_tree.commit('moar work plz')
208
208
    def test_branch_stacked(self):
209
209
        # We have a mainline
210
210
        trunk_tree = self.make_branch_and_tree('mainline',
211
 
            format='development')
 
211
            format='1.9')
212
212
        original_revid = trunk_tree.commit('mainline')
213
213
        self.assertRevisionInRepository('mainline', original_revid)
214
214
        # and a branch from it which is stacked
226
226
        # We can branch stacking on a smart server
227
227
        from bzrlib.smart.server import SmartTCPServer_for_testing
228
228
        self.transport_server = SmartTCPServer_for_testing
229
 
        trunk = self.make_branch('mainline', format='development')
 
229
        trunk = self.make_branch('mainline', format='1.9')
230
230
        out, err = self.run_bzr(
231
231
            ['branch', '--stacked', self.get_url('mainline'), 'shallow'])
232
232
 
237
237
            ['branch', '--stacked', 'trunk', 'shallow'])
238
238
        # We should notify the user that we upgraded their format
239
239
        self.assertEqualDiff(
240
 
            'Source format does not support stacking, using format: \'1.6\'\n'
 
240
            'Source repository format does not support stacking, using format:\n'
241
241
            '  Packs 5 (adds stacking support, requires bzr 1.6)\n'
242
 
            '\n'
 
242
            'Source branch format does not support stacking, using format:\n'
 
243
            '  Branch format 7\n'
243
244
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
244
245
            err)
245
246
 
249
250
            ['branch', '--stacked', 'trunk', 'shallow'])
250
251
        # We should notify the user that we upgraded their format
251
252
        self.assertEqualDiff(
252
 
            'Source format does not support stacking, using format:'
253
 
            ' \'1.6.1-rich-root\'\n'
 
253
            'Source repository format does not support stacking, using format:\n'
254
254
            '  Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n'
255
 
            '\n'
 
255
            'Source branch format does not support stacking, using format:\n'
 
256
            '  Branch format 7\n'
256
257
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
257
258
            err)
258
259
 
267
268
        self.reset_smart_call_log()
268
269
        out, err = self.run_bzr(['branch', self.get_url('from'),
269
270
            self.get_url('target')])
270
 
        rpc_count = len(self.hpss_calls)
271
271
        # This figure represent the amount of work to perform this use case. It
272
272
        # is entirely ok to reduce this number if a test fails due to rpc_count
273
273
        # being too low. If rpc_count increases, more network roundtrips have
274
274
        # become necessary for this use case. Please do not adjust this number
275
275
        # upwards without agreement from bzr's network support maintainers.
276
 
        self.assertEqual(53, rpc_count)
 
276
        self.assertLength(39, self.hpss_calls)
277
277
 
278
278
    def test_branch_from_trivial_branch_streaming_acceptance(self):
279
279
        self.setup_smart_server_with_call_log()
283
283
        self.reset_smart_call_log()
284
284
        out, err = self.run_bzr(['branch', self.get_url('from'),
285
285
            'local-target'])
286
 
        rpc_count = len(self.hpss_calls)
287
286
        # This figure represent the amount of work to perform this use case. It
288
287
        # is entirely ok to reduce this number if a test fails due to rpc_count
289
288
        # being too low. If rpc_count increases, more network roundtrips have
290
289
        # become necessary for this use case. Please do not adjust this number
291
290
        # upwards without agreement from bzr's network support maintainers.
292
 
        self.assertEqual(10, rpc_count)
 
291
        self.assertLength(10, self.hpss_calls)
293
292
 
294
293
    def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
295
294
        self.setup_smart_server_with_call_log()
302
301
        self.reset_smart_call_log()
303
302
        out, err = self.run_bzr(['branch', self.get_url('feature'),
304
303
            'local-target'])
305
 
        rpc_count = len(self.hpss_calls)
306
304
        # This figure represent the amount of work to perform this use case. It
307
305
        # is entirely ok to reduce this number if a test fails due to rpc_count
308
306
        # being too low. If rpc_count increases, more network roundtrips have
309
307
        # become necessary for this use case. Please do not adjust this number
310
308
        # upwards without agreement from bzr's network support maintainers.
311
 
        self.assertEqual(74, rpc_count)
 
309
        self.assertLength(15, self.hpss_calls)
312
310
 
313
311
 
314
312
class TestRemoteBranch(TestCaseWithSFTPServer):