~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006-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
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
 
335
339
        # The push should have created target/a
336
340
        self.failUnlessExists('target/a')
337
341
 
 
342
    def test_push_use_existing_into_empty_bzrdir(self):
 
343
        """'bzr push --use-existing-dir' into a dir with an empty .bzr dir
 
344
        fails.
 
345
        """
 
346
        tree = self.create_simple_tree()
 
347
        self.build_tree(['target/', 'target/.bzr/'])
 
348
        self.run_bzr_error(
 
349
            ['Target directory ../target already contains a .bzr directory, '
 
350
             'but it is not valid.'],
 
351
            'push ../target --use-existing-dir', working_dir='tree')
 
352
 
338
353
    def test_push_onto_repo(self):
339
354
        """We should be able to 'bzr push' into an existing bzrdir."""
340
355
        tree = self.create_simple_tree()
569
584
 
570
585
class RedirectingMemoryServer(memory.MemoryServer):
571
586
 
572
 
    def setUp(self):
 
587
    def start_server(self):
573
588
        self._dirs = {'/': None}
574
589
        self._files = {}
575
590
        self._locks = {}
583
598
        result._locks = self._locks
584
599
        return result
585
600
 
586
 
    def tearDown(self):
 
601
    def stop_server(self):
587
602
        transport.unregister_transport(self._scheme, self._memory_factory)
588
603
 
589
604
 
757
772
        self.set_config_push_strict('oFF')
758
773
        self.assertPushFails(['--strict'])
759
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")