/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/branch_implementations/test_create_checkout.py

merge bzr.dev.

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
"""Tests for the Branch.create_checkout"""
18
18
 
26
26
class TestCreateCheckout(TestCaseWithBranch):
27
27
 
28
28
    def test_checkout_format(self):
29
 
        """Make sure the new checkout uses the same branch format."""
 
29
        """Make sure the new checkout uses the desired branch format."""
30
30
        a_branch = self.make_branch('branch')
31
 
        if isinstance(a_branch, RemoteBranch):
32
 
            # RemoteBranch formats are not the same as local ones, and dont
33
 
            # duplicate the format string (because there is no format string as
34
 
            # such - it might be e.g. totally virtual on the server end).
35
 
            # This test can only assess the checkout format correctness *in
36
 
            # general* when there is a real object locally present for both the
37
 
            # source and target.
38
 
            return
39
31
        tree = a_branch.create_checkout('checkout')
40
 
        if self.branch_format in branch._legacy_formats:
41
 
            # Legacy formats create checkouts with the default format.
42
 
            # Only newer formats create identical checkouts.
43
 
            expected_format = branch.BranchFormat.get_default_format()
44
 
        else:
45
 
            expected_format = a_branch._format
 
32
        # All branches can define the format they want checkouts made in.
 
33
        # This checks it is honoured.
 
34
        expected_format = a_branch._get_checkout_format().get_branch_format()
46
35
        self.assertEqual(expected_format.__class__,
47
36
                         tree.branch._format.__class__)
48
37
 
71
60
    def test_create_checkout_exists(self):
72
61
        """We shouldn't fail if the directory already exists."""
73
62
        tree1 = self.make_branch_and_tree('base')
74
 
        self.build_tree('checkout')
 
63
        self.build_tree(['checkout/'])
75
64
        tree2 = tree1.branch.create_checkout('checkout', lightweight=True)