27
27
from bzrlib.branch import Branch
28
28
from bzrlib.revision import is_ancestor
29
29
from bzrlib.upgrade import upgrade
32
# TODO: Hoist these to the test utility module
33
# TODO: Script to write a description of a directory for testing
34
# TODO: Helper that compares two structures and raises a helpful error
37
def build_tree_contents(template):
38
"""Reconstitute some files from a text description.
40
Each element of template is a tuple. The first element is a filename,
41
with an optional ending character indicating the type.
43
The template is built relative to the Python process's current
51
raise NotImplementedError('symlinks not handled yet')
60
def pack_tree_contents(top):
61
"""Make a Python datastructure description of a tree.
63
If top is an absolute path the descriptions will be absolute."""
64
for dirpath, dirnames, filenames in os.walk(top):
65
yield (dirpath + '/', )
68
fullpath = os.path.join(dirpath, fn)
69
yield (fullpath, file(fullpath, 'rb').read())
30
from bzrlib.selftest.treeshape import build_tree_contents
72
32
class TestUpgrade(TestCaseInTempDir):
73
33
def test_build_tree(self):