##// END OF EJS Templates
store: optimize _auxencode() by assigning to the list elements of the path
Adrian Buehlmann -
r17571:7ed972a9 default
parent child Browse files
Show More
@@ -141,11 +141,12 b' def _auxencode(path, dotencode):'
141 141 >>> _auxencode(' .foo', True)
142 142 '~20.foo'
143 143 '''
144 res = []
145 for n in path.split('/'):
144 res = path.split('/')
145 for i, n in enumerate(res):
146 146 if n:
147 147 if dotencode and n[0] in '. ':
148 148 n = "~%02x" % ord(n[0]) + n[1:]
149 res[i] = n
149 150 else:
150 151 l = n.find('.')
151 152 if l == -1:
@@ -156,10 +157,11 b' def _auxencode(path, dotencode):'
156 157 # encode third letter ('aux' -> 'au~78')
157 158 ec = "~%02x" % ord(n[2])
158 159 n = n[0:2] + ec + n[3:]
160 res[i] = n
159 161 if n[-1] in '. ':
160 162 # encode last period or space ('foo...' -> 'foo..~2e')
161 163 n = n[:-1] + "~%02x" % ord(n[-1])
162 res.append(n)
164 res[i] = n
163 165 return '/'.join(res)
164 166
165 167 _maxstorepathlen = 120
General Comments 0
You need to be logged in to leave comments. Login now