##// END OF EJS Templates
test-hybridencode: more testcases
Adrian Buehlmann -
r17432:61bd77b5 default
parent child Browse files
Show More
@@ -6,10 +6,43 b' hybridencode = lambda f: store._hybriden'
6 enc = hybridencode # used for 'dotencode' repo format
6 enc = hybridencode # used for 'dotencode' repo format
7
7
8 def show(s):
8 def show(s):
9 print "A = '%s'" % s
9 print "A = '%s'" % s.encode("string_escape")
10 print "B = '%s'" % enc(s)
10 print "B = '%s'" % enc(s).encode("string_escape")
11 print
11 print
12
12
13 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}")
14
15 print "uppercase char X is encoded as _x"
16 show("data/ABCDEFGHIJKLMNOPQRSTUVWXYZ")
17
18 print "underbar is doubled"
19 show("data/_")
20
21 print "tilde is character-encoded"
22 show("data/~")
23
24 print "characters in ASCII code range 0..31"
25 show('data/\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'
26 '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f')
27
28 print "characters in ASCII code range 126..255 (only partially tested)"
29 show('data/\x7e \x7f \x80 \x81 \x82 \x83 .. \xfd \xfe \xff')
30
31 print "Windows reserved characters"
32 show('data/less <, greater >, colon :, double-quote ", backslash \\'
33 ', pipe |, question-mark ?, asterisk *')
34
35 print "encoding directories ending in .hg, .i or .d with '.hg' suffix"
36 show('data/x.hg/x.i/x.d/foo')
37
38 print "but these are not encoded on *filenames*"
39 show('data/foo/x.hg')
40 show('data/foo/x.i')
41 show('data/foo/x.d')
42
43 print "plain .hg, .i and .d directories have the leading dot encoded"
44 show('data/.hg/.i/.d/foo')
45
13 show('data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i')
46 show('data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i')
14
47
15 show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/'
48 show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/'
@@ -24,5 +57,47 b" show('data/Project Planning/Resources/An"
24 show('data/Project.Planning/Resources/AnotherLongDirectoryName/'
57 show('data/Project.Planning/Resources/AnotherLongDirectoryName/'
25 'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
58 'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
26 show('data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i')
59 show('data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i')
27 show('data/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9')
60
28 show('data/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9')
61 show('data/c/co/com/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9')
62 show('data/C/CO/COM/COM0/COM1/COM2/COM3/COM4/COM5/COM6/COM7/COM8/COM9')
63 show('data/c.x/co.x/com.x/com0.x/com1.x/com2.x/com3.x/com4.x/com5.x'
64 '/com6.x/com7.x/com8.x/com9.x')
65 show('data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5'
66 '/x.com6/x.com7/x.com8/x.com9')
67 show('data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x'
68 '/com6x/com7x/com8x/com9x')
69 show('data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5'
70 '/xcom6/xcom7/xcom8/xcom9')
71
72 show('data/l/lp/lpt/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9')
73 show('data/L/LP/LPT/LPT0/LPT1/LPT2/LPT3/LPT4/LPT5/LPT6/LPT7/LPT8/LPT9')
74 show('data/l.x/lp.x/lpt.x/lpt0.x/lpt1.x/lpt2.x/lpt3.x/lpt4.x/lpt5.x'
75 '/lpt6.x/lpt7.x/lpt8.x/lpt9.x')
76 show('data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5'
77 '/x.lpt6/x.lpt7/x.lpt8/x.lpt9')
78 show('data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x'
79 '/lpt6x/lpt7x/lpt8x/lpt9x')
80 show('data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5'
81 '/xlpt6/xlpt7/xlpt8/xlpt9')
82
83 show('data/con/p/pr/prn/a/au/aux/n/nu/nul')
84 show('data/CON/P/PR/PRN/A/AU/AUX/N/NU/NUL')
85 show('data/con.x/p.x/pr.x/prn.x/a.x/au.x/aux.x/n.x/nu.x/nul.x')
86 show('data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul')
87 show('data/conx/px/prx/prnx/ax/aux/auxx/nx/nux/nulx')
88 show('data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul')
89
90 print "largest unhashed path"
91 show('data/123456789-123456789-123456789-123456789-123456789-'
92 'unhashed--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
93 '123456789-12345')
94
95 print "shortest hashed path"
96 show('data/123456789-123456789-123456789-123456789-123456789-'
97 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
98 '123456789-123456')
99
100 print "changing one char in part that's hashed away produces a different hash"
101 show('data/123456789-123456789-123456789-123456789-123456789-'
102 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxy-'
103 '123456789-123456')
@@ -1,3 +1,48 b''
1 A = 'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}'
2 B = 'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}'
3
4 uppercase char X is encoded as _x
5 A = 'data/ABCDEFGHIJKLMNOPQRSTUVWXYZ'
6 B = 'data/_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z'
7
8 underbar is doubled
9 A = 'data/_'
10 B = 'data/__'
11
12 tilde is character-encoded
13 A = 'data/~'
14 B = 'data/~7e'
15
16 characters in ASCII code range 0..31
17 A = 'data/\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'
18 B = 'data/~00~01~02~03~04~05~06~07~08~09~0a~0b~0c~0d~0e~0f~10~11~12~13~14~15~16~17~18~19~1a~1b~1c~1d~1e~1f'
19
20 characters in ASCII code range 126..255 (only partially tested)
21 A = 'data/~ \x7f \x80 \x81 \x82 \x83 .. \xfd \xfe \xff'
22 B = 'data/~7e ~7f ~80 ~81 ~82 ~83 .. ~fd ~fe ~ff'
23
24 Windows reserved characters
25 A = 'data/less <, greater >, colon :, double-quote ", backslash \\, pipe |, question-mark ?, asterisk *'
26 B = 'data/less ~3c, greater ~3e, colon ~3a, double-quote ~22, backslash ~5c, pipe ~7c, question-mark ~3f, asterisk ~2a'
27
28 encoding directories ending in .hg, .i or .d with '.hg' suffix
29 A = 'data/x.hg/x.i/x.d/foo'
30 B = 'data/x.hg.hg/x.i.hg/x.d.hg/foo'
31
32 but these are not encoded on *filenames*
33 A = 'data/foo/x.hg'
34 B = 'data/foo/x.hg'
35
36 A = 'data/foo/x.i'
37 B = 'data/foo/x.i'
38
39 A = 'data/foo/x.d'
40 B = 'data/foo/x.d'
41
42 plain .hg, .i and .d directories have the leading dot encoded
43 A = 'data/.hg/.i/.d/foo'
44 B = 'data/~2ehg.hg/~2ei.hg/~2ed.hg/foo'
45
1 A = 'data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i'
46 A = 'data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i'
2 B = 'data/au~78.bla/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i'
47 B = 'data/au~78.bla/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i'
3
48
@@ -19,9 +64,69 b" B = 'dh/project_/resource/anotherl/follo"
19 A = 'data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i'
64 A = 'data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i'
20 B = 'data/foo..~2e/foo ~20/~20/a~2e/__.~20/____/~2ex.~2e/~20 bla/~2e_f_o_o/something.i'
65 B = 'data/foo..~2e/foo ~20/~20/a~2e/__.~20/____/~2ex.~2e/~20 bla/~2e_f_o_o/something.i'
21
66
22 A = 'data/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9'
67 A = 'data/c/co/com/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9'
23 B = 'data/com0/co~6d1/co~6d2/co~6d3/co~6d4/co~6d5/co~6d6/co~6d7/co~6d8/co~6d9'
68 B = 'data/c/co/com/com0/co~6d1/co~6d2/co~6d3/co~6d4/co~6d5/co~6d6/co~6d7/co~6d8/co~6d9'
69
70 A = 'data/C/CO/COM/COM0/COM1/COM2/COM3/COM4/COM5/COM6/COM7/COM8/COM9'
71 B = 'data/_c/_c_o/_c_o_m/_c_o_m0/_c_o_m1/_c_o_m2/_c_o_m3/_c_o_m4/_c_o_m5/_c_o_m6/_c_o_m7/_c_o_m8/_c_o_m9'
72
73 A = 'data/c.x/co.x/com.x/com0.x/com1.x/com2.x/com3.x/com4.x/com5.x/com6.x/com7.x/com8.x/com9.x'
74 B = 'data/c.x/co.x/com.x/com0.x/co~6d1.x/co~6d2.x/co~6d3.x/co~6d4.x/co~6d5.x/co~6d6.x/co~6d7.x/co~6d8.x/co~6d9.x'
75
76 A = 'data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5/x.com6/x.com7/x.com8/x.com9'
77 B = 'data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5/x.com6/x.com7/x.com8/x.com9'
78
79 A = 'data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x/com6x/com7x/com8x/com9x'
80 B = 'data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x/com6x/com7x/com8x/com9x'
81
82 A = 'data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5/xcom6/xcom7/xcom8/xcom9'
83 B = 'data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5/xcom6/xcom7/xcom8/xcom9'
84
85 A = 'data/l/lp/lpt/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9'
86 B = 'data/l/lp/lpt/lpt0/lp~741/lp~742/lp~743/lp~744/lp~745/lp~746/lp~747/lp~748/lp~749'
87
88 A = 'data/L/LP/LPT/LPT0/LPT1/LPT2/LPT3/LPT4/LPT5/LPT6/LPT7/LPT8/LPT9'
89 B = 'data/_l/_l_p/_l_p_t/_l_p_t0/_l_p_t1/_l_p_t2/_l_p_t3/_l_p_t4/_l_p_t5/_l_p_t6/_l_p_t7/_l_p_t8/_l_p_t9'
90
91 A = 'data/l.x/lp.x/lpt.x/lpt0.x/lpt1.x/lpt2.x/lpt3.x/lpt4.x/lpt5.x/lpt6.x/lpt7.x/lpt8.x/lpt9.x'
92 B = 'data/l.x/lp.x/lpt.x/lpt0.x/lp~741.x/lp~742.x/lp~743.x/lp~744.x/lp~745.x/lp~746.x/lp~747.x/lp~748.x/lp~749.x'
93
94 A = 'data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5/x.lpt6/x.lpt7/x.lpt8/x.lpt9'
95 B = 'data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5/x.lpt6/x.lpt7/x.lpt8/x.lpt9'
96
97 A = 'data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x/lpt6x/lpt7x/lpt8x/lpt9x'
98 B = 'data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x/lpt6x/lpt7x/lpt8x/lpt9x'
24
99
25 A = 'data/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9'
100 A = 'data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5/xlpt6/xlpt7/xlpt8/xlpt9'
26 B = 'data/lpt0/lp~741/lp~742/lp~743/lp~744/lp~745/lp~746/lp~747/lp~748/lp~749'
101 B = 'data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5/xlpt6/xlpt7/xlpt8/xlpt9'
102
103 A = 'data/con/p/pr/prn/a/au/aux/n/nu/nul'
104 B = 'data/co~6e/p/pr/pr~6e/a/au/au~78/n/nu/nu~6c'
105
106 A = 'data/CON/P/PR/PRN/A/AU/AUX/N/NU/NUL'
107 B = 'data/_c_o_n/_p/_p_r/_p_r_n/_a/_a_u/_a_u_x/_n/_n_u/_n_u_l'
108
109 A = 'data/con.x/p.x/pr.x/prn.x/a.x/au.x/aux.x/n.x/nu.x/nul.x'
110 B = 'data/co~6e.x/p.x/pr.x/pr~6e.x/a.x/au.x/au~78.x/n.x/nu.x/nu~6c.x'
111
112 A = 'data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul'
113 B = 'data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul'
27
114
115 A = 'data/conx/px/prx/prnx/ax/aux/auxx/nx/nux/nulx'
116 B = 'data/conx/px/prx/prnx/ax/au~78/auxx/nx/nux/nulx'
117
118 A = 'data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul'
119 B = 'data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul'
120
121 largest unhashed path
122 A = 'data/123456789-123456789-123456789-123456789-123456789-unhashed--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'
123 B = 'data/123456789-123456789-123456789-123456789-123456789-unhashed--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'
124
125 shortest hashed path
126 A = 'data/123456789-123456789-123456789-123456789-123456789-hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'
127 B = 'dh/123456789-123456789-123456789-123456789-123456789-hashed----xxxxxxxxx-xxxxxxxe9c55002b50bf5181e7a6fc1f60b126e2a6fcf71'
128
129 changing one char in part that's hashed away produces a different hash
130 A = 'data/123456789-123456789-123456789-123456789-123456789-hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxy-123456789-123456'
131 B = 'dh/123456789-123456789-123456789-123456789-123456789-hashed----xxxxxxxxx-xxxxxxxd24fa4455faf8a94350c18e5eace7c2bb17af706'
132
General Comments 0
You need to be logged in to leave comments. Login now