1
# Copyright (C) 2007 Canonical Ltd
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.
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.
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
18
from bzrlib import tests
20
class TestMergeDirective(tests.TestCaseWithTransport):
22
def test_merge_directive(self):
23
tree1 = self.make_branch_and_tree('tree1')
24
self.build_tree_contents([('tree1/file', 'a\nb\nc\nd\n')])
27
tree2=tree1.bzrdir.sprout('tree2').open_workingtree()
28
self.build_tree_contents([('tree1/file', 'a\nb\nc\nd\ne\n')])
31
self.run_bzr_error(('No submit branch',), 'merge-directive', retcode=3)
32
self.run_bzr('merge-directive', '../tree2')
33
md_text = self.run_bzr('merge-directive')[0]
34
self.assertContainsRe(md_text, "Bazaar revision bundle")
35
self.assertNotContainsRe(md_text, 'source_branch:')
36
self.assertContainsRe(md_text, "\\+e")
37
self.run_bzr_error(('No public branch',), 'merge-directive', '--diff',
39
self.run_bzr('merge-directive', '--diff', '../tree2', '.')
40
md_text = self.run_bzr('merge-directive', '--diff')[0]
41
self.assertNotContainsRe(md_text, "Bazaar revision bundle")
42
self.assertContainsRe(md_text, "\\+e")
43
md_text = self.run_bzr('merge-directive', '--plain')[0]
44
self.assertNotContainsRe(md_text, "\\+e")
45
md_text = self.run_bzr('merge-directive')[0]
46
self.assertContainsRe(md_text, 'source_branch:')