/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/zip_exporter.py

Merge with __contains__

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
import stat
 
22
import time
22
23
import zipfile
23
24
 
24
25
from bzrlib import (
25
26
    osutils,
26
27
    )
 
28
from bzrlib.export import _export_iter_entries
27
29
from bzrlib.trace import mutter
28
30
 
29
31
 
35
37
_DIR_ATTR = stat.S_IFDIR | ZIP_DIRECTORY_BIT
36
38
 
37
39
 
38
 
def zip_exporter(tree, dest, root):
 
40
def zip_exporter(tree, dest, root, subdir):
39
41
    """ Export this tree to a new zip file.
40
42
 
41
43
    `dest` will be created holding the contents of this tree; if it
42
44
    already exists, it will be overwritten".
43
45
    """
44
 
    import time
 
46
    mutter('export version %r', tree)
45
47
 
46
48
    now = time.localtime()[:6]
47
 
    mutter('export version %r', tree)
48
49
 
49
50
    compression = zipfile.ZIP_DEFLATED
50
51
    zipf = zipfile.ZipFile(dest, "w", compression)
51
52
 
52
 
    inv = tree.inventory
53
 
 
54
53
    try:
55
 
        entries = inv.iter_entries()
56
 
        entries.next() # skip root
57
 
        for dp, ie in entries:
58
 
            # .bzrignore has no meaning outside of a working tree
59
 
            # so do not export it
60
 
            if dp == ".bzrignore":
61
 
                continue
62
 
 
 
54
        for dp, ie in _export_iter_entries(tree, subdir):
63
55
            file_id = ie.file_id
64
56
            mutter("  export {%s} kind %s to %s", file_id, ie.kind, dest)
65
57