##// END OF EJS Templates
store: let _auxencode() return the list of path segments...
Adrian Buehlmann -
r17574:81a033bb default
parent child Browse files
Show More
@@ -133,13 +133,13 b' def _auxencode(path, dotencode):'
133 doesn't need encoding.
133 doesn't need encoding.
134
134
135 >>> _auxencode('.foo/aux.txt/txt.aux/con/prn/nul/foo.', True)
135 >>> _auxencode('.foo/aux.txt/txt.aux/con/prn/nul/foo.', True)
136 '~2efoo/au~78.txt/txt.aux/co~6e/pr~6e/nu~6c/foo~2e'
136 ['~2efoo', 'au~78.txt', 'txt.aux', 'co~6e', 'pr~6e', 'nu~6c', 'foo~2e']
137 >>> _auxencode('.com1com2/lpt9.lpt4.lpt1/conprn/com0/lpt0/foo.', False)
137 >>> _auxencode('.com1com2/lpt9.lpt4.lpt1/conprn/com0/lpt0/foo.', False)
138 '.com1com2/lp~749.lpt4.lpt1/conprn/com0/lpt0/foo~2e'
138 ['.com1com2', 'lp~749.lpt4.lpt1', 'conprn', 'com0', 'lpt0', 'foo~2e']
139 >>> _auxencode('foo. ', True)
139 >>> _auxencode('foo. ', True)
140 'foo.~20'
140 ['foo.~20']
141 >>> _auxencode(' .foo', True)
141 >>> _auxencode(' .foo', True)
142 '~20.foo'
142 ['~20.foo']
143 '''
143 '''
144 res = path.split('/')
144 res = path.split('/')
145 for i, n in enumerate(res):
145 for i, n in enumerate(res):
@@ -162,7 +162,7 b' def _auxencode(path, dotencode):'
162 if n[-1] in '. ':
162 if n[-1] in '. ':
163 # encode last period or space ('foo...' -> 'foo..~2e')
163 # encode last period or space ('foo...' -> 'foo..~2e')
164 res[i] = n[:-1] + "~%02x" % ord(n[-1])
164 res[i] = n[:-1] + "~%02x" % ord(n[-1])
165 return '/'.join(res)
165 return res
166
166
167 _maxstorepathlen = 120
167 _maxstorepathlen = 120
168 _dirprefixlen = 8
168 _dirprefixlen = 8
@@ -203,12 +203,11 b' def _hybridencode(path, auxencode):'
203 # escape directories ending with .i and .d
203 # escape directories ending with .i and .d
204 path = encodedir(path)
204 path = encodedir(path)
205 ndpath = path[len('data/'):]
205 ndpath = path[len('data/'):]
206 res = 'data/' + auxencode(encodefilename(ndpath))
206 res = 'data/' + '/'.join(auxencode(encodefilename(ndpath)))
207 if len(res) > _maxstorepathlen:
207 if len(res) > _maxstorepathlen:
208 digest = _sha(path).hexdigest()
208 digest = _sha(path).hexdigest()
209 aep = auxencode(lowerencode(ndpath))
209 parts = auxencode(lowerencode(ndpath))
210 _root, ext = os.path.splitext(aep)
210 _root, ext = os.path.splitext(parts[-1])
211 parts = aep.split('/')
212 basename = parts[-1]
211 basename = parts[-1]
213 sdirs = []
212 sdirs = []
214 for p in parts[:-1]:
213 for p in parts[:-1]:
General Comments 0
You need to be logged in to leave comments. Login now