/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-18 18:18:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090618181836-biodfkat9a8eyzjz
The new add_inventory_by_delta is returning a CHKInventory when mapping from NULL
Which is completely valid, but 'broke' one of the tests.
So to fix it, changed the test to use CHKInventories on both sides, and add an __eq__
member. The nice thing is that CHKInventory.__eq__ is fairly cheap, since it only
has to check the root keys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009 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()
71
66
        repo = newdir.create_repository(shared=True)
72
67
        repo.set_make_working_trees(False)
73
68
        out, err = self.run_bzr('init repo')
74
 
        self.assertEqual("""Created a repository tree (format: %s)
 
69
        self.assertEqual("""Created a repository tree (format: pack-0.92)
75
70
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')
 
71
""" % urlutils.local_path_from_url(
 
72
            repo.bzrdir.root_transport.external_url()), out)
 
73
        self.assertEndsWith(out, "bzrlib.tests.blackbox.test_init.TestInit."
 
74
            "test_init_at_repository_root/work/repo/\n")
80
75
        self.assertEqual('', err)
81
76
        newdir.open_branch()
82
77
        newdir.open_workingtree()
83
78
 
84
79
    def test_init_branch(self):
85
80
        out, err = self.run_bzr('init')
86
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
87
 
            self._default_label,), out)
 
81
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
82
            out)
88
83
        self.assertEqual('', err)
89
84
 
90
85
        # Can it handle subdirectories of branches too ?
91
86
        out, err = self.run_bzr('init subdir1')
92
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
93
 
            self._default_label,), out)
 
87
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
88
            out)
94
89
        self.assertEqual('', err)
95
90
        WorkingTree.open('subdir1')
96
91
 
101
96
 
102
97
        os.mkdir('subdir2')
103
98
        out, err = self.run_bzr('init subdir2')
104
 
        self.assertEqual("Created a standalone tree (format: %s)\n" % (
105
 
            self._default_label,), out)
 
99
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
100
            out)
106
101
        self.assertEqual('', err)
107
102
        # init an existing branch.
108
103
        out, err = self.run_bzr('init subdir2', retcode=3)
168
163
 
169
164
    def test_init(self):
170
165
        # init on a remote url should succeed.
171
 
        out, err = self.run_bzr(['init', '--pack-0.92', self.get_url()])
 
166
        out, err = self.run_bzr(['init', self.get_url()])
172
167
        self.assertEqual(out,
173
168
            """Created a standalone branch (format: pack-0.92)\n""")
174
169
        self.assertEqual('', err)
196
191
    def test_init_append_revisions_only(self):
197
192
        self.run_bzr('init --dirstate-tags normal_branch6')
198
193
        branch = _mod_branch.Branch.open('normal_branch6')
199
 
        self.assertEqual(None, branch._get_append_revisions_only())
 
194
        self.assertEqual(False, branch._get_append_revisions_only())
200
195
        self.run_bzr('init --append-revisions-only --dirstate-tags branch6')
201
196
        branch = _mod_branch.Branch.open('branch6')
202
197
        self.assertEqual(True, branch._get_append_revisions_only())