/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/workingtree_implementations/test_subsume.py

  • Committer: Aaron Bentley
  • Date: 2006-09-27 04:15:52 UTC
  • mto: (2100.3.5 by-reference-trees)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: aaron.bentley@utoronto.ca-20060927041552-4283b801890541b6
Initial subsume implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 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
from bzrlib import inventory, tests
 
18
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
19
 
 
20
 
 
21
class TestWorkingTree(TestCaseWithWorkingTree):
 
22
 
 
23
    def test_subsume_tree(self):
 
24
        self.build_tree(['tree/', 'tree/file', 'tree/subtree/',
 
25
                         'tree/subtree/file2'])
 
26
        base_tree = self.make_branch_and_tree('tree')
 
27
        if base_tree.get_root_id() == inventory.ROOT_ID:
 
28
            raise tests.TestSkipped('This test requires unique roots')
 
29
        base_tree.add('file', 'file-id')
 
30
        base_tree.commit('first commit', rev_id='tree-1')
 
31
        sub_tree = self.make_branch_and_tree('tree/subtree')
 
32
        sub_tree.add('file2', 'file2-id')
 
33
        sub_tree.commit('first commit', rev_id='subtree-1')
 
34
        sub_root_id = sub_tree.get_root_id()
 
35
        base_tree.subsume(sub_tree)
 
36
        self.assertEqual(['tree-1', 'subtree-1'], base_tree.get_parent_ids())
 
37
        self.assertEqual(sub_root_id, base_tree.path2id('subtree'))
 
38
        self.assertEqual('file2-id', base_tree.path2id('subtree/file2'))