/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 breezy/archive/zip.py

  • Committer: Jelmer Vernooij
  • Date: 2018-10-29 11:27:33 UTC
  • mto: This revision was merged to the branch mainline in revision 7170.
  • Revision ID: jelmer@jelmer.uk-20181029112733-bjvm24z12svwl53m
Get rid of file_ids in most of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        with closing(zipfile.ZipFile(buf, "w", compression)) as zipf, \
57
57
             tree.lock_read():
58
58
            for dp, tp, ie in _export_iter_entries(tree, subdir):
59
 
                file_id = getattr(ie, 'file_id', None)
60
 
                mutter("  export {%s} kind %s to %s", file_id, ie.kind, dest)
 
59
                mutter("  export {%s} kind %s to %s", tp, ie.kind, dest)
61
60
 
62
61
                # zipfile.ZipFile switches all paths to forward
63
62
                # slashes anyway, so just stick with that.
64
63
                if force_mtime is not None:
65
64
                    mtime = force_mtime
66
65
                else:
67
 
                    mtime = tree.get_file_mtime(tp, file_id)
 
66
                    mtime = tree.get_file_mtime(tp)
68
67
                date_time = time.localtime(mtime)[:6]
69
68
                filename = osutils.pathjoin(root, dp)
70
69
                if ie.kind == "file":
73
72
                                date_time=date_time)
74
73
                    zinfo.compress_type = compression
75
74
                    zinfo.external_attr = _FILE_ATTR
76
 
                    content = tree.get_file_text(tp, file_id)
 
75
                    content = tree.get_file_text(tp)
77
76
                    zipf.writestr(zinfo, content)
78
77
                elif ie.kind in ("directory", "tree-reference"):
79
78
                    # Directories must contain a trailing slash, to indicate
91
90
                                date_time=date_time)
92
91
                    zinfo.compress_type = compression
93
92
                    zinfo.external_attr = _FILE_ATTR
94
 
                    zipf.writestr(zinfo, tree.get_symlink_target(tp, file_id))
 
93
                    zipf.writestr(zinfo, tree.get_symlink_target(tp))
95
94
        # Urgh, headers are written last since they include e.g. file size.
96
95
        # So we have to buffer it all :(
97
96
        buf.seek(0)