/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 breezy/bzr/tests/test_transform.py

Split out git and bzr-specific transforms.

Merged from https://code.launchpad.net/~jelmer/brz/transform-file-id/+merge/386859

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006-2012, 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
from . import TestCaseWithTransport
 
18
 
 
19
 
 
20
class TestInventoryAltered(TestCaseWithTransport):
 
21
 
 
22
    def test_inventory_altered_unchanged(self):
 
23
        tree = self.make_branch_and_tree('tree')
 
24
        self.build_tree(['tree/foo'])
 
25
        tree.add('foo', b'foo-id')
 
26
        with tree.preview_transform() as tt:
 
27
            self.assertEqual([], tt._inventory_altered())
 
28
 
 
29
    def test_inventory_altered_changed_parent_id(self):
 
30
        tree = self.make_branch_and_tree('tree')
 
31
        self.build_tree(['tree/foo'])
 
32
        tree.add('foo', b'foo-id')
 
33
        with tree.preview_transform() as tt:
 
34
            tt.unversion_file(tt.root)
 
35
            tt.version_file(tt.root, file_id=b'new-id')
 
36
            foo_trans_id = tt.trans_id_tree_path('foo')
 
37
            foo_tuple = ('foo', foo_trans_id)
 
38
            root_tuple = ('', tt.root)
 
39
            self.assertEqual([root_tuple, foo_tuple], tt._inventory_altered())
 
40
 
 
41
    def test_inventory_altered_noop_changed_parent_id(self):
 
42
        tree = self.make_branch_and_tree('tree')
 
43
        self.build_tree(['tree/foo'])
 
44
        tree.add('foo', b'foo-id')
 
45
        with tree.preview_transform() as tt:
 
46
            tt.unversion_file(tt.root)
 
47
            tt.version_file(tt.root, file_id=tree.path2id(''))
 
48
            tt.trans_id_tree_path('foo')
 
49
            self.assertEqual([], tt._inventory_altered())