Merged wrong patch (was: [merge][0.11] bugfix 56815: export unicode files to tar+zip)
Alexander Belchenko
bialix at ukr.net
Sat Sep 23 11:23:33 BST 2006
John Arbash Meinel пишет:
Your patch is wrong:
=== modified file bzrlib/export/zip_exporter.py
> --- bzrlib/export/zip_exporter.py
> +++ bzrlib/export/zip_exporter.py
> @@ -49,21 +49,22 @@
> file_id = ie.file_id
> mutter(" export {%s} kind %s to %s", file_id, ie.kind, dest)
>
> + filename = os.path.join(root, dp).encode('utf8')
> if ie.kind == "file":
> zinfo = zipfile.ZipInfo(
> - filename=str(os.path.join(root, dp)),
> + filename=filename,
> date_time=now)
> zinfo.compress_type = compression
> zipf.writestr(zinfo, tree.get_file_text(file_id))
> elif ie.kind == "directory":
> zinfo = zipfile.ZipInfo(
> - filename=str(os.path.join(root, dp)+os.sep),
> + filename=filename,
^^^^^^^^^^^^^^^^^^
it's wrong
Here should be filename that ends with '/' otherwise empty directories
appears as files with zero length.
It's easily can be tested with this commands:
$ bzr init zip-test
$ cd zip-test
$ bzr mkdir dir
$ bzr ci -m "dir"
$ bzr export test.zip
And then examine content of zip archive.
I'm again think that fast merging of your patch for zip exporter is bad
idea.
--
Alexander
More information about the bazaar
mailing list