~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/dir_exporter.py

  • Committer: Robert Collins
  • Date: 2008-08-08 06:59:48 UTC
  • mto: This revision was merged to the branch mainline in revision 3618.
  • Revision ID: robertc@robertcollins.net-20080808065948-io0c6pfo305ss5vj
Refactor exporters to remove obvious duplication to a helper function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os
22
22
 
23
23
from bzrlib import errors, osutils
 
24
from bzrlib.export import _export_iter_entries
24
25
from bzrlib.trace import mutter
25
26
 
26
27
 
36
37
    :note: If the export fails, the destination directory will be
37
38
           left in a half-assed state.
38
39
    """
 
40
    mutter('export version %r', tree)
39
41
    os.mkdir(dest)
40
 
    mutter('export version %r', tree)
41
 
    inv = tree.inventory
42
 
    if subdir is None:
43
 
        subdir_id = None
44
 
    else:
45
 
        subdir_id = inv.path2id(subdir)
46
 
    entries = inv.iter_entries(subdir_id)
47
 
    if subdir is None:
48
 
        entries.next() # skip root
49
 
    for dp, ie in entries:
50
 
        # The .bzr* namespace is reserved for "magic" files like
51
 
        # .bzrignore and .bzrrules - do not export these
52
 
        if dp.startswith(".bzr"):
53
 
            continue
54
 
        
 
42
    for dp, ie in _export_iter_entries(tree, subdir):
55
43
        fullpath = osutils.pathjoin(dest, dp)
56
44
        if ie.kind == "file":
57
45
            fileobj = tree.get_file(ie.file_id)