~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to baz2bzr

  • Committer: abentley
  • Date: 2005-04-28 06:03:07 UTC
  • Revision ID: abentley@lappy-20050428060307-03d4406b07ada771
changed add_file, add_dir interfaces

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    pybaz.register_revision_library(lib_dir)
51
51
    return tdir
52
52
 
53
 
def add_file(path, text):
 
53
def add_file(path, text, id):
54
54
    """
55
55
    >>> q = test_environ()
56
 
    >>> add_file("path with space", "text")
 
56
    >>> add_file("path with space", "text", "lalala")
57
57
    >>> tree = pybaz.tree_root(".")
58
58
    >>> inv = list(tree.iter_inventory_ids(source=True, both=True))
59
59
    >>> ("x_lalala", "path with space") in inv
61
61
    >>> teardown_environ(q)
62
62
    """
63
63
    file(path, "wb").write(text)
64
 
    add_id([path], "lalala")
65
 
 
66
 
 
67
 
def add_dir(path):
 
64
    add_id([path], id)
 
65
 
 
66
 
 
67
def add_dir(path, id):
68
68
    """
69
69
    >>> q = test_environ()
70
 
    >>> add_dir("path with\(sp) space")
 
70
    >>> add_dir("path with\(sp) space", "lalala")
71
71
    >>> tree = pybaz.tree_root(".")
72
72
    >>> inv = list(tree.iter_inventory_ids(source=True, both=True))
73
73
    >>> ("x_lalala", "path with\(sp) space") in inv
75
75
    >>> teardown_environ(q)
76
76
    """
77
77
    os.mkdir(path)
78
 
    add_id([path], "lalala")
 
78
    add_id([path], id)
79
79
 
80
80
def teardown_environ(tdir):
81
81
    os.chdir("/")