/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_init.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-12 18:05:15 UTC
  • mto: (4371.4.5 vila-better-heads)
  • mto: This revision was merged to the branch mainline in revision 4449.
  • Revision ID: john@arbash-meinel.com-20090612180515-t0cwbjsnve094oik
Add a failing test for handling nodes that are in the same linear chain.

It fails because the ancestry skipping causes us to miss the fact that the two nodes
are actually directly related. We could check at the beginning, as the 
code used to do, but I think that will be incomplete for the more-than-two
heads cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 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
22
22
 
23
23
from bzrlib import (
24
24
    branch as _mod_branch,
25
 
    osutils,
26
25
    urlutils,
27
26
    )
28
27
from bzrlib.bzrdir import BzrDirMetaFormat1
34
33
 
35
34
class TestInit(ExternalBase):
36
35
 
37
 
    def setUp(self):
38
 
        ExternalBase.setUp(self)
39
 
        self._default_label = '2a'
40
 
 
41
36
    def test_init_with_format(self):
42
37
        # Verify bzr init --format constructs something plausible
43
38
        t = self.get_transport()
54
49
            out)
55
50
        self.assertEqual('', err)
56
51
 
57
 
    def test_init_format_2a(self):
58
 
        """Smoke test for constructing a format 2a repoistory."""
59
 
        out, err = self.run_bzr('init --format=2a')
60
 
        self.assertEqual("""Created a standalone tree (format: 2a)\n""",
61
 
            out)
62
 
        self.assertEqual('', err)
63
 
 
64
52
    def test_init_at_repository_root(self):
65
53
        # bzr init at the root of a repository should create a branch
66
54
        # and working tree even when creation of working trees is disabled.
71
59
        repo = newdir.create_repository(shared=True)
72
60
        repo.set_make_working_trees(False)
73
61
        out, err = self.run_bzr('init repo')
74
 
        self.assertEqual("""Created a repository tree (format: %s)
 
62
        self.assertEqual("""Created a repository tree (format: pack-0.92)
75
63
Using shared repository: %s
76
 
""" % (self._default_label, urlutils.local_path_from_url(
77
 
            repo.bzrdir.root_transport.external_url())), out)
78
 
        cwd = osutils.getcwd()
79
 
        self.assertEndsWith(out, cwd + '/repo/\n')
 
64
""" % urlutils.local_path_from_url(
 
65
            repo.bzrdir.root_transport.external_url()), out)
 
66
        self.assertEndsWith(out, "bzrlib.tests.blackbox.test_init.TestInit."
 
67
            "test_init_at_repository_root/work/repo/\n")
80
68
        self.assertEqual('', err)
81
69
        newdir.open_branch()
82
70
        newdir.open_workingtree()
83
71
 
84
72
    def test_init_branch(self):
85
73
        out, err = self.run_bzr('init')
86
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
87
 
            self._default_label,), out)
 
74
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
75
            out)
88
76
        self.assertEqual('', err)
89
77
 
90
78
        # Can it handle subdirectories of branches too ?
91
79
        out, err = self.run_bzr('init subdir1')
92
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
93
 
            self._default_label,), out)
 
80
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
81
            out)
94
82
        self.assertEqual('', err)
95
83
        WorkingTree.open('subdir1')
96
84
 
101
89
 
102
90
        os.mkdir('subdir2')
103
91
        out, err = self.run_bzr('init subdir2')
104
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
105
 
            self._default_label,), out)
 
92
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
93
            out)
106
94
        self.assertEqual('', err)
107
95
        # init an existing branch.
108
96
        out, err = self.run_bzr('init subdir2', retcode=3)
168
156
 
169
157
    def test_init(self):
170
158
        # init on a remote url should succeed.
171
 
        out, err = self.run_bzr(['init', '--pack-0.92', self.get_url()])
 
159
        out, err = self.run_bzr(['init', self.get_url()])
172
160
        self.assertEqual(out,
173
161
            """Created a standalone branch (format: pack-0.92)\n""")
174
162
        self.assertEqual('', err)
196
184
    def test_init_append_revisions_only(self):
197
185
        self.run_bzr('init --dirstate-tags normal_branch6')
198
186
        branch = _mod_branch.Branch.open('normal_branch6')
199
 
        self.assertEqual(None, branch._get_append_revisions_only())
 
187
        self.assertEqual(False, branch._get_append_revisions_only())
200
188
        self.run_bzr('init --append-revisions-only --dirstate-tags branch6')
201
189
        branch = _mod_branch.Branch.open('branch6')
202
190
        self.assertEqual(True, branch._get_append_revisions_only())