/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/__init__.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:
132
132
    return dest
133
133
 
134
134
 
 
135
def _export_iter_entries(tree, subdir):
 
136
    """Iter the entries for tree suitable for exporting.
 
137
 
 
138
    :param tree: A tree object.
 
139
    :param subdir: None or the path of a directory to start exporting from.
 
140
    """
 
141
    inv = tree.inventory
 
142
    if subdir is None:
 
143
        subdir_id = None
 
144
    else:
 
145
        subdir_id = inv.path2id(subdir)
 
146
    entries = inv.iter_entries(subdir_id)
 
147
    if subdir is None:
 
148
        entries.next() # skip root
 
149
    for entry in entries:
 
150
        # The .bzr* namespace is reserved for "magic" files like
 
151
        # .bzrignore and .bzrrules - do not export these
 
152
        if entry[0].startswith(".bzr"):
 
153
            continue
 
154
        yield entry
 
155
 
 
156
 
135
157
register_lazy_exporter(None, [], 'bzrlib.export.dir_exporter', 'dir_exporter')
136
158
register_lazy_exporter('dir', [], 'bzrlib.export.dir_exporter', 'dir_exporter')
137
159
register_lazy_exporter('tar', ['.tar'], 'bzrlib.export.tar_exporter', 'tar_exporter')