[MERGE] gen_file_ids() should create more filesystem friendly file ids.
John Arbash Meinel
john at arbash-meinel.com
Thu Jul 20 03:59:44 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> On 18 Jul 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
>> The attached patch fixes bug:
>> https://launchpad.net/products/bzr/+bug/43801
>
> +1 for 0.9, thankyou.
>
...
>> + # We truncate long filenames to be friendly to OS. This is
>> + # less important with case squashing, because we do less escaping
>> + # (A long all-caps filename used to create a *huge* filename on disk)
>> + fid = gen_file_id('A'*50 + '.txt')
>
>> + self.assertStartsWith(fid, 'a'*20 + '-')
>
> Perhaps it would be more to the point of your comment to assert that the
> result is less than ~60 characters (or whatever)
This one, I agree can just test the length of the file id.
>
>> +
>> + # restricting length happens after the other actions, so
>> + # we preserv as much as possible
>> + fid = gen_file_id('\xe5\xb5..aBcd\tefGhijKLMnop\tqrstuvwxyz')
>> + self.assertStartsWith(fid, 'abcdefghijklmnopqrst-')
>
> and again here.
I can test the length. But I'm also asserting that it is grabbing 20
*good* characters, rather than grabbing the first 20, and then smashing
(ending up with < 20).
I also just saw that I have a spelling error in the comment, which I'll fix.
>
> I realize they'll both pass but I'm just thinking about making sure to
> test the right requirement.
>
> Thanks for adding the tests.
>
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEvvGfJdeBCYSNAAMRAjqYAKC7DzEGj/m7jeVw1eL+w+8tWVTB+QCdFGYB
yXG4REAY5Lvxvu+Bc/SmBRU=
=hgHb
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list