3
from bzrlib.branch import ScratchBranch
6
from bzrlib.selftest import InTempDir, TestBase
7
from bzrlib.branch import ScratchBranch, Branch
4
8
from bzrlib.errors import NotBranchError
5
from unittest import TestCase
8
class BranchPathTestCase(TestCase):
11
class RenameDirs(InTempDir):
12
"""Test renaming directories and the files within them."""
14
from bzrlib.commit import commit
16
b = Branch('.', init=True)
17
self.build_tree(['dir/', 'dir/sub/', 'dir/sub/file'])
18
b.add(['dir', 'dir/sub', 'dir/sub/file'])
20
b.commit('create initial state')
22
# TODO: lift out to a test helper that checks the shape of
25
revid = b.revision_history()[0]
26
self.log('first revision_id is {%s}' % revid)
28
inv = b.get_revision_inventory(revid)
29
self.log('contents of inventory: %r' % inv.entries())
31
self.check_inventory_shape(inv,
32
['dir', 'dir/sub', 'dir/sub/file'])
37
class BranchPathTestCase(TestBase):
9
38
"""test for branch path lookups
11
40
Branch.relpath and bzrlib.branch._relpath do a simple but subtle
12
41
job: given a path (either relative to cwd or absolute), work out
13
42
if it is inside a branch and return the path relative to the base.
17
46
from bzrlib.branch import _relpath
18
47
import tempfile, shutil