##// END OF EJS Templates
test-hybridencode: use store._dothybridencode(s)...
Adrian Buehlmann -
r17622:57bf8667 default
parent child Browse files
Show More
@@ -1,22 +1,17 b''
1 from mercurial import parsers, store
1 from mercurial import store
2
3 hybridencode = lambda f: store._hybridencode(f, True)
4
5 pathencode = getattr(parsers, 'pathencode', None)
6 def pencode(f):
7 pe = pathencode(f)
8 if pe is None:
9 return store._hashencode(store.encodedir(f), True)
10 return pe
11
2
12 def show(s):
3 def show(s):
4 # show test input
13 print "A = '%s'" % s.encode("string_escape")
5 print "A = '%s'" % s.encode("string_escape")
14 he = hybridencode(s)
6
15 print "B = '%s'" % he.encode("string_escape")
7 # show the result of the C implementation, if available
16 if pathencode:
8 h = store._dothybridencode(s)
17 pe = pencode(s)
9 print "B = '%s'" % h.encode("string_escape")
18 if pe != he:
10
19 print "N = '%s'" % pe.encode("string_escape")
11 # compare it with reference implementation in Python
12 r = store._hybridencode(s, True)
13 if h != r:
14 print "R = '%s'" % r.encode("string_escape")
20 print
15 print
21
16
22 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}")
17 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}")
General Comments 0
You need to be logged in to leave comments. Login now