/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 bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2008-10-10 05:27:20 UTC
  • mto: (3363.19.2 fix-iter-changes)
  • mto: This revision was merged to the branch mainline in revision 3777.
  • Revision ID: aaron@aaronbentley.com-20081010052720-izbsk3d87f5rv6eq
Implement create_by_tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
2176
2176
        tt.create_directory(trans_id)
2177
2177
 
2178
2178
 
 
2179
def create_from_tree(tt, trans_id, tree, file_id):
 
2180
    """Create new file contents according to tree contents."""
 
2181
    kind = tree.kind(file_id)
 
2182
    if kind == 'directory':
 
2183
        tt.create_directory(trans_id)
 
2184
    elif kind == "file":
 
2185
        tree_file = tree.get_file(file_id)
 
2186
        try:
 
2187
            lines = tree_file.readlines()
 
2188
        finally:
 
2189
            tree_file.close()
 
2190
        tt.create_file(lines, trans_id)
 
2191
    elif kind == "symlink":
 
2192
        tt.create_symlink(tree.get_symlink_target(file_id), trans_id)
 
2193
 
 
2194
 
2179
2195
def create_entry_executability(tt, entry, trans_id):
2180
2196
    """Set the executability of a trans_id according to an inventory entry"""
2181
2197
    if entry.kind == "file":