~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Martin Pool
  • Date: 2010-06-02 05:03:31 UTC
  • mto: This revision was merged to the branch mainline in revision 5279.
  • Revision ID: mbp@canonical.com-20100602050331-n2p1qt8hfsahspnv
Correct more sloppy use of the term 'Linux'

Show diffs side-by-side

added added

removed removed

Lines of Context:
2291
2291
    for num, _unused in enumerate(wt.all_file_ids()):
2292
2292
        if num > 0:  # more than just a root
2293
2293
            raise errors.WorkingTreeAlreadyPopulated(base=wt.basedir)
 
2294
    existing_files = set()
 
2295
    for dir, files in wt.walkdirs():
 
2296
        existing_files.update(f[0] for f in files)
2294
2297
    file_trans_id = {}
2295
2298
    top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
2296
2299
    pp = ProgressPhase("Build phase", 2, top_pb)
2320
2323
                precomputed_delta = []
2321
2324
            else:
2322
2325
                precomputed_delta = None
2323
 
            # Check if tree inventory has content. If so, we populate
2324
 
            # existing_files with the directory content. If there are no
2325
 
            # entries we skip populating existing_files as its not used.
2326
 
            # This improves performance and unncessary work on large
2327
 
            # directory trees. (#501307)
2328
 
            if total > 0:
2329
 
                existing_files = set()
2330
 
                for dir, files in wt.walkdirs():
2331
 
                    existing_files.update(f[0] for f in files)
2332
2326
            for num, (tree_path, entry) in \
2333
2327
                enumerate(tree.inventory.iter_entries_by_dir()):
2334
2328
                pb.update("Building tree", num - len(deferred_contents), total)
2529
2523
        raise errors.BadFileKindError(name, kind)
2530
2524
 
2531
2525
 
 
2526
@deprecated_function(deprecated_in((1, 9, 0)))
 
2527
def create_by_entry(tt, entry, tree, trans_id, lines=None, mode_id=None):
 
2528
    """Create new file contents according to an inventory entry.
 
2529
 
 
2530
    DEPRECATED.  Use create_from_tree instead.
 
2531
    """
 
2532
    if entry.kind == "file":
 
2533
        if lines is None:
 
2534
            lines = tree.get_file(entry.file_id).readlines()
 
2535
        tt.create_file(lines, trans_id, mode_id=mode_id)
 
2536
    elif entry.kind == "symlink":
 
2537
        tt.create_symlink(tree.get_symlink_target(entry.file_id), trans_id)
 
2538
    elif entry.kind == "directory":
 
2539
        tt.create_directory(trans_id)
 
2540
 
 
2541
 
2532
2542
def create_from_tree(tt, trans_id, tree, file_id, bytes=None,
2533
2543
    filter_tree_path=None):
2534
2544
    """Create new file contents according to tree contents.