[MERGE] gen_file_ids() should create more filesystem friendly file ids.

John Arbash Meinel john at arbash-meinel.com
Tue Jul 18 17:03:25 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patch fixes bug:
https://launchpad.net/products/bzr/+bug/43801

Basically, because we escape capital letters, and re-use the full
filename, on Windows if you tried to add a file like:

THIS_IS_A_LONG_FILENAME_WITH_EVERYTHING_IN_CAPS

Every character would end up escaped into something like this on disk:
%54%48%49%53%5f%49%53%5f%41%5f%4c%4f%4e%47%5f%46%49%4c%45%4e%41%4d%45%5f%57%49%54%48%5f%45%56%45%52%59%54%48%49%4e%47%5f%49%4e%5f%43%41%50%53

And that would be too long.

This patch also fixes another bug that I found, which is that if we are
using a unicode filename, the smashing happens after removing the
initial '.' characters. So smashing µ.txt would create a fileid
'.txt-xxxxyyy'
Which would create a hidden file.

The new code removes beginning dots *after* pulling out non-word characters.

The basic effect was +1 about 2 months ago, but there were no tests.
I've updated the test suite.

The biggest reason I want this now, is that without it, you can create
trees that won't ever check out on windows. Because they can create
paths that are too long. So it needs to be done sooner, rather than later.

Oddly enough, generating file ids this way is at least on par speed wise
with original way. It might actually be faster, my average indicates
this, but it is within the noise:

bzr.dev		smaller-file-ids
4176ms		3587ms
3771ms		3790ms
4110ms		4136ms
3709ms		3729ms
4388ms		4135ms
- -----------------------
4030		3875

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEvQZNJdeBCYSNAAMRAqoIAJwO+M7BVq1jA1rIQT3tuw93QBEongCgsJBy
Y02oL3S0uJsE8HBZ6+DGEpQ=
=Ol1Z
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smaler-file-ids.patch
Type: text/x-patch
Size: 4647 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060718/57cfa215/attachment.bin 


More information about the bazaar mailing list