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
17
"""Blackbox testing for merge_into functionality."""
23
from bzrlib.tests.test_merge_into import TestMergeIntoBase
26
class TestMergeInto(TestMergeIntoBase):
29
# Just make sure the command-line works
30
project_wt, lib_wt = self.setup_two_branches()
32
self.run_bzr('merge-into ../lib1 lib1', working_dir='project')
34
project_wt.lock_read()
36
new_lib1_id = project_wt.path2id('lib1')
37
# The lib-1 revision should be merged into this one
38
self.assertEqual(['project-1', 'lib-1'],
39
project_wt.get_parent_ids())
40
files = [(path, ie.kind, ie.file_id)
41
for path, ie in project_wt.iter_entries_by_dir()]
42
exp_files = [('', 'directory', 'project-root-id'),
43
('README', 'file', 'readme-id'),
44
('dir', 'directory', 'dir-id'),
45
('lib1', 'directory', new_lib1_id),
46
('dir/file.c', 'file', 'file.c-id'),
47
('lib1/Makefile', 'file', 'makefile-lib-id'),
48
('lib1/README', 'file', 'readme-lib-id'),
49
('lib1/foo.c', 'file', 'foo.c-lib-id'),
51
self.assertEqual(exp_files, files)
55
def test_dotted_name(self):
56
project_wt, lib_wt = self.setup_two_branches()
58
self.run_bzr('merge-into ../lib1 ./lib1', working_dir='project')
60
project_wt.lock_read()
62
new_lib1_id = project_wt.path2id('lib1')
63
# The lib-1 revision should be merged into this one
64
self.assertEqual(['project-1', 'lib-1'],
65
project_wt.get_parent_ids())
66
files = [(path, ie.kind, ie.file_id)
67
for path, ie in project_wt.iter_entries_by_dir()]
68
exp_files = [('', 'directory', 'project-root-id'),
69
('README', 'file', 'readme-id'),
70
('dir', 'directory', 'dir-id'),
71
('lib1', 'directory', new_lib1_id),
72
('dir/file.c', 'file', 'file.c-id'),
73
('lib1/Makefile', 'file', 'makefile-lib-id'),
74
('lib1/README', 'file', 'readme-lib-id'),
75
('lib1/foo.c', 'file', 'foo.c-lib-id'),
77
self.assertEqual(exp_files, files)