1
# Copyright (C) 2008 Aaron Bentley
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
"""Tests for the 'brz link-tree' command."""
26
from ..features import (
31
class TestLinkTreeCommand(tests.TestCaseWithTransport):
33
_test_needs_features = [HardlinkFeature]
36
tests.TestCaseWithTransport.setUp(self)
37
self.parent_tree = self.make_branch_and_tree('parent')
38
self.parent_tree.lock_write()
39
self.addCleanup(self.parent_tree.unlock)
40
self.build_tree_contents([('parent/foo', b'bar')])
41
self.parent_tree.add('foo', b'foo-id')
42
self.parent_tree.commit('added foo')
43
child_controldir = self.parent_tree.controldir.sprout('child')
44
self.child_tree = child_controldir.open_workingtree()
47
parent_stat = os.lstat(self.parent_tree.abspath('foo'))
48
child_stat = os.lstat(self.child_tree.abspath('foo'))
49
return parent_stat.st_ino == child_stat.st_ino
51
def test_link_tree(self):
52
"""Ensure the command works as intended"""
54
self.parent_tree.unlock()
55
self.run_bzr('link-tree ../parent')
56
self.assertTrue(self.hardlinked())
57
# want teh addCleanup to work properly
58
self.parent_tree.lock_write()