~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-03-02 02:46:26 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: aaron.bentley@utoronto.ca-20070302024626-nxb07lxv8k162wwd
Get merge-directive command basically working

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
import os
 
18
from bzrlib import tests
 
19
 
 
20
class TestMergeDirective(tests.TestCaseWithTransport):
 
21
 
 
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')])
 
25
        tree1.add('file')
 
26
        tree1.commit('foo')
 
27
        tree2=tree1.bzrdir.sprout('tree2').open_workingtree()
 
28
        self.build_tree_contents([('tree1/file', 'a\nb\nc\nd\ne\n')])
 
29
        tree1.commit('bar')
 
30
        os.chdir('tree1')
 
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',
 
38
                           retcode=3)
 
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:')