/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
4593.2.1 by Martin Pool
bundle_info blackbox test passes on rich-root formats
1
# Copyright (C) 2007, 2009 Canonical Ltd
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
16
17
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
18
from breezy import (
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
19
    merge_directive,
20
    tests,
21
    )
22
23
24
class TestBundleInfo(tests.TestCaseWithTransport):
25
26
    def test_bundle_info(self):
27
        source = self.make_branch_and_tree('source')
28
        self.build_tree(['source/foo'])
29
        source.add('foo')
6855.4.1 by Jelmer Vernooij
Yet more bees.
30
        source.commit('added file', rev_id=b'rev1')
6973.14.6 by Jelmer Vernooij
Fix some more tests.
31
        with open('bundle', 'wb') as bundle:
32
            source.branch.repository.create_bundle(b'rev1', b'null:', bundle,
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
33
                                                   '4')
34
        info = self.run_bzr('bundle-info bundle')[0]
4593.2.1 by Martin Pool
bundle_info blackbox test passes on rich-root formats
35
        # there might be either one file, or two, depending on whether the
36
        # tree root counts...
7027.10.1 by Jelmer Vernooij
Various blackbox test fixes.
37
        self.assertContainsRe(info, 'file: [12] .0 multiparent.')
38
        self.assertContainsRe(info, 'nicks: source')
39
        self.assertNotContainsRe(info, 'foo')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
40
        self.run_bzr_error(['--verbose requires a merge directive'],
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
41
                           'bundle-info -v bundle')
42
        target = self.make_branch('target')
43
        md = merge_directive.MergeDirective2.from_objects(
6973.14.6 by Jelmer Vernooij
Fix some more tests.
44
            source.branch.repository, b'rev1', 0, 0, 'target',
6855.4.1 by Jelmer Vernooij
Yet more bees.
45
            base_revision_id=b'null:')
6973.14.6 by Jelmer Vernooij
Fix some more tests.
46
        with open('directive', 'wb') as directive:
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
47
            directive.writelines(md.to_lines())
48
        info = self.run_bzr('bundle-info -v directive')[0]
7027.10.1 by Jelmer Vernooij
Various blackbox test fixes.
49
        self.assertContainsRe(info, 'foo')