~bzr-pqm/bzr/bzr.dev

1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
1
# Copyright (C) 2007 Canonical Ltd
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
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
18
from bzrlib import (
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')
30
        source.commit('added file', rev_id='rev1')
31
        bundle = open('bundle', 'wb')
32
        try:
33
            source.branch.repository.create_bundle('rev1', 'null:', bundle,
34
                                                   '4')
35
        finally:
36
            bundle.close()
37
        info = self.run_bzr('bundle-info bundle')[0]
38
        self.assertContainsRe(info, 'file: 1 .0 multiparent.')
39
        self.assertContainsRe(info, 'nicks: source')
40
        self.assertNotContainsRe(info, 'foo')
3221.1.6 by Martin Pool
Better error message from bundle-info
41
        self.run_bzr_error(['--verbose requires a merge directive'],
1551.18.5 by Aaron Bentley
Add test cases for bzr bundle-info
42
                           'bundle-info -v bundle')
43
        target = self.make_branch('target')
44
        md = merge_directive.MergeDirective2.from_objects(
45
            source.branch.repository, 'rev1', 0, 0, 'target',
46
            base_revision_id='null:')
47
        directive = open('directive', 'wb')
48
        try:
49
            directive.writelines(md.to_lines())
50
        finally:
51
            directive.close()
52
        info = self.run_bzr('bundle-info -v directive')[0]
53
        self.assertContainsRe(info, 'foo')