/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-05-28 08:00:39 UTC
  • mto: (5050.3.16 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: andrew.bennetts@canonical.com-20100528080039-0sa30to282l6opjk
Very rough first draft of cmd_merge_into from bzr-merge-into.  Passes its blackbox tests.

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
"""Blackbox testing for merge_into functionality."""
 
18
 
 
19
from bzrlib import (
 
20
    tests,
 
21
    )
 
22
 
 
23
from bzrlib.tests.test_merge_into import TestMergeIntoBase
 
24
 
 
25
 
 
26
class TestMergeInto(TestMergeIntoBase):
 
27
 
 
28
    def test_smoke(self):
 
29
        # Just make sure the command-line works
 
30
        project_wt, lib_wt = self.setup_two_branches()
 
31
 
 
32
        self.run_bzr('merge-into ../lib1 lib1', working_dir='project')
 
33
 
 
34
        project_wt.lock_read()
 
35
        try:
 
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'),
 
50
                        ]
 
51
            self.assertEqual(exp_files, files)
 
52
        finally:
 
53
            project_wt.unlock()
 
54
 
 
55
    def test_dotted_name(self):
 
56
        project_wt, lib_wt = self.setup_two_branches()
 
57
 
 
58
        self.run_bzr('merge-into ../lib1 ./lib1', working_dir='project')
 
59
 
 
60
        project_wt.lock_read()
 
61
        try:
 
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'),
 
76
                        ]
 
77
            self.assertEqual(exp_files, files)
 
78
        finally:
 
79
            project_wt.unlock()