##// END OF EJS Templates
store: extract functions _encodefname and _decodefname
Adrian Buehlmann -
r17608:77624012 default
parent child Browse files
Show More
@@ -93,10 +93,24 b' def _buildencodefun():'
93 pass
93 pass
94 else:
94 else:
95 raise KeyError
95 raise KeyError
96 return (lambda s: "".join([cmap[c] for c in encodedir(s)]),
96 return (lambda s: ''.join([cmap[c] for c in s]),
97 lambda s: decodedir("".join(list(decode(s)))))
97 lambda s: ''.join(list(decode(s))))
98
99 _encodefname, _decodefname = _buildencodefun()
98
100
99 encodefilename, decodefilename = _buildencodefun()
101 def encodefilename(s):
102 '''
103 >>> encodefilename('foo.i/bar.d/bla.hg/hi:world?/HELLO')
104 'foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o'
105 '''
106 return _encodefname(encodedir(s))
107
108 def decodefilename(s):
109 '''
110 >>> decodefilename('foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o')
111 'foo.i/bar.d/bla.hg/hi:world?/HELLO'
112 '''
113 return decodedir(_decodefname(s))
100
114
101 def _buildlowerencodefun():
115 def _buildlowerencodefun():
102 '''
116 '''
General Comments 0
You need to be logged in to leave comments. Login now