~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-14 00:01:32 UTC
  • mfrom: (4957.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100114000132-3p3rabnonjw3gzqb
(jam) Merge bzr.stable, bringing in bug fixes #175839, #504390

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
239
239
        out = self.run_bzr('pull ../branch_a', retcode=3)
240
240
        self.assertEqual(out,
241
241
                ('','bzr: ERROR: These branches have diverged.'
242
 
                    ' Use the merge command to reconcile them.\n'))
 
242
                    ' Use the missing command to see how.\n'
 
243
                    'Use the merge command to reconcile them.\n'))
243
244
        self.assertEqual(branch_b.get_parent(), parent)
244
245
        # test implicit --remember after resolving previous failure
245
246
        uncommit(branch=branch_b, tree=tree_b)
358
359
        self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n')
359
360
        self.assertNotContainsRe(
360
361
            out, r'revno: 1\ncommitter: .*\nbranch nick: source')
 
362
 
 
363
    def test_pull_smart_stacked_streaming_acceptance(self):
 
364
        """'bzr pull -r 123' works on stacked, smart branches, even when the
 
365
        revision specified by the revno is only present in the fallback
 
366
        repository.
 
367
 
 
368
        See <https://launchpad.net/bugs/380314>
 
369
        """
 
370
        self.setup_smart_server_with_call_log()
 
371
        # Make a stacked-on branch with two commits so that the
 
372
        # revision-history can't be determined just by looking at the parent
 
373
        # field in the revision in the stacked repo.
 
374
        parent = self.make_branch_and_tree('parent', format='1.9')
 
375
        parent.commit(message='first commit')
 
376
        parent.commit(message='second commit')
 
377
        local = parent.bzrdir.sprout('local').open_workingtree()
 
378
        local.commit(message='local commit')
 
379
        local.branch.create_clone_on_transport(
 
380
            self.get_transport('stacked'), stacked_on=self.get_url('parent'))
 
381
        empty = self.make_branch_and_tree('empty', format='1.9')
 
382
        self.reset_smart_call_log()
 
383
        self.run_bzr(['pull', '-r', '1', self.get_url('stacked')],
 
384
            working_dir='empty')
 
385
        # This figure represent the amount of work to perform this use case. It
 
386
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
387
        # being too low. If rpc_count increases, more network roundtrips have
 
388
        # become necessary for this use case. Please do not adjust this number
 
389
        # upwards without agreement from bzr's network support maintainers.
 
390
        self.assertLength(18, self.hpss_calls)
 
391
        remote = Branch.open('stacked')
 
392
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 
393
    
 
394
    def test_pull_cross_format_warning(self):
 
395
        """You get a warning for probably slow cross-format pulls.
 
396
        """
 
397
 
 
398
        from_tree = self.make_branch_and_tree('from', format='2a')
 
399
        to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
 
400
        from_tree.commit(message='first commit')
 
401
        out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
 
402
        self.assertContainsRe(err,
 
403
            "(?m)Fetching between repositories with different formats.*")