/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/export/dir_exporter.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-08-11 03:39:25 UTC
  • mfrom: (3613.2.2 export)
  • Revision ID: pqm@pqm.ubuntu.com-20080811033925-rwcu69eiq0zg0buv
(robertc) Teach export to export subdirectories as well as entire
        branches. (Robert Collins)

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
 
27
 
def dir_exporter(tree, dest, root):
 
28
def dir_exporter(tree, dest, root, subdir):
28
29
    """Export this tree to a new directory.
29
30
 
30
31
    `dest` should not exist, and will be created holding the
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
 
    entries = inv.iter_entries()
43
 
    entries.next() # skip root
44
 
    for dp, ie in entries:
45
 
        # The .bzr* namespace is reserved for "magic" files like
46
 
        # .bzrignore and .bzrrules - do not export these
47
 
        if dp.startswith(".bzr"):
48
 
            continue
49
 
        
 
42
    for dp, ie in _export_iter_entries(tree, subdir):
50
43
        fullpath = osutils.pathjoin(dest, dp)
51
44
        if ie.kind == "file":
52
45
            fileobj = tree.get_file(ie.file_id)