/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: Robert Collins
  • Date: 2008-08-08 05:25:58 UTC
  • mto: This revision was merged to the branch mainline in revision 3618.
  • Revision ID: robertc@robertcollins.net-20080808052558-b3xkprmd19buq12s
Teach export how to export a subdirectory. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from bzrlib.trace import mutter
25
25
 
26
26
 
27
 
def dir_exporter(tree, dest, root):
 
27
def dir_exporter(tree, dest, root, subdir):
28
28
    """Export this tree to a new directory.
29
29
 
30
30
    `dest` should not exist, and will be created holding the
39
39
    os.mkdir(dest)
40
40
    mutter('export version %r', tree)
41
41
    inv = tree.inventory
42
 
    entries = inv.iter_entries()
43
 
    entries.next() # skip root
 
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
44
49
    for dp, ie in entries:
45
50
        # The .bzr* namespace is reserved for "magic" files like
46
51
        # .bzrignore and .bzrrules - do not export these