/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_push.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:
31
31
    workingtree
32
32
    )
33
33
from bzrlib.repofmt import knitrepo
34
 
from bzrlib.tests import http_server
 
34
from bzrlib.tests import (
 
35
    blackbox,
 
36
    http_server,
 
37
    test_foreign,
 
38
    )
35
39
from bzrlib.transport import memory
36
40
 
37
41
 
253
257
        # upwards without agreement from bzr's network support maintainers.
254
258
        self.assertLength(11, self.hpss_calls)
255
259
 
 
260
    def test_push_smart_incremental_acceptance(self):
 
261
        self.setup_smart_server_with_call_log()
 
262
        t = self.make_branch_and_tree('from')
 
263
        rev_id1 = t.commit(allow_pointless=True, message='first commit')
 
264
        rev_id2 = t.commit(allow_pointless=True, message='second commit')
 
265
        self.run_bzr(
 
266
            ['push', self.get_url('to-one'), '-r1'], working_dir='from')
 
267
        self.reset_smart_call_log()
 
268
        self.run_bzr(['push', self.get_url('to-one')], working_dir='from')
 
269
        # This figure represent the amount of work to perform this use case. It
 
270
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
271
        # being too low. If rpc_count increases, more network roundtrips have
 
272
        # become necessary for this use case. Please do not adjust this number
 
273
        # upwards without agreement from bzr's network support maintainers.
 
274
        self.assertLength(11, self.hpss_calls)
 
275
 
256
276
    def test_push_smart_with_default_stacking_url_path_segment(self):
257
277
        # If the default stacked-on location is a path element then branches
258
278
        # we push there over the smart server are stacked and their
564
584
 
565
585
class RedirectingMemoryServer(memory.MemoryServer):
566
586
 
567
 
    def setUp(self):
 
587
    def start_server(self):
568
588
        self._dirs = {'/': None}
569
589
        self._files = {}
570
590
        self._locks = {}
578
598
        result._locks = self._locks
579
599
        return result
580
600
 
581
 
    def tearDown(self):
 
601
    def stop_server(self):
582
602
        transport.unregister_transport(self._scheme, self._memory_factory)
583
603
 
584
604
 
587
607
    def setUp(self):
588
608
        tests.TestCaseWithTransport.setUp(self)
589
609
        self.memory_server = RedirectingMemoryServer()
590
 
        self.memory_server.setUp()
591
 
        self.addCleanup(self.memory_server.tearDown)
592
 
 
 
610
        self.start_server(self.memory_server)
593
611
        # Make the branch and tree that we'll be pushing.
594
612
        t = self.make_branch_and_tree('tree')
595
613
        self.build_tree(['tree/file'])
692
710
 
693
711
    def setUp(self):
694
712
        super(TestPushStrictWithChanges, self).setUp()
 
713
        # Apply the changes defined in load_tests: one of _uncommitted_changes,
 
714
        # _pending_merges or _out_of_sync_trees
695
715
        getattr(self, self._changes_type)()
696
716
 
697
717
    def _uncommitted_changes(self):
752
772
        self.set_config_push_strict('oFF')
753
773
        self.assertPushFails(['--strict'])
754
774
        self.assertPushSucceeds([])
 
775
 
 
776
 
 
777
class TestPushForeign(blackbox.ExternalBase):
 
778
 
 
779
    def setUp(self):
 
780
        super(TestPushForeign, self).setUp()
 
781
        test_foreign.register_dummy_foreign_for_test(self)
 
782
 
 
783
    def make_dummy_builder(self, relpath):
 
784
        builder = self.make_branch_builder(
 
785
            relpath, format=test_foreign.DummyForeignVcsDirFormat())
 
786
        builder.build_snapshot('revid', None,
 
787
            [('add', ('', 'TREE_ROOT', 'directory', None)),
 
788
             ('add', ('foo', 'fooid', 'file', 'bar'))])
 
789
        return builder
 
790
 
 
791
    def test_no_roundtripping(self):
 
792
        target_branch = self.make_dummy_builder('dp').get_branch()
 
793
        source_tree = self.make_branch_and_tree("dc")
 
794
        output, error = self.run_bzr("push -d dc dp", retcode=3)
 
795
        self.assertEquals("", output)
 
796
        self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
 
797
            " push to dummy. You may want to use dpush instead.\n")