##// END OF EJS Templates
store: remove pointless pathjoiner parameter...
Adrian Buehlmann -
r13426:643b8212 default
parent child Browse files
Show More
@@ -115,9 +115,7 b' class statichttprepository(localrepo.loc'
115 115 raise error.RepoError(_("requirement '%s' not supported") % r)
116 116
117 117 # setup store
118 def pjoin(a, b):
119 return a + '/' + b
120 self.store = store.store(requirements, self.path, opener, pjoin)
118 self.store = store.store(requirements, self.path, opener)
121 119 self.spath = self.store.path
122 120 self.sopener = self.store.opener
123 121 self.sjoin = self.store.join
@@ -169,8 +169,7 b' def _calcmode(path):'
169 169
170 170 class basicstore(object):
171 171 '''base class for local repository stores'''
172 def __init__(self, path, opener, pathjoiner):
173 self.pathjoiner = pathjoiner
172 def __init__(self, path, opener):
174 173 self.path = path
175 174 self.createmode = _calcmode(path)
176 175 op = opener(self.path)
@@ -178,19 +177,21 b' class basicstore(object):'
178 177 self.opener = lambda f, *args, **kw: op(encodedir(f), *args, **kw)
179 178
180 179 def join(self, f):
181 return self.pathjoiner(self.path, encodedir(f))
180 return self.path + '/' + encodedir(f)
182 181
183 182 def _walk(self, relpath, recurse):
184 183 '''yields (unencoded, encoded, size)'''
185 path = self.pathjoiner(self.path, relpath)
186 striplen = len(self.path) + len(os.sep)
184 path = self.path
185 if relpath:
186 path += '/' + relpath
187 striplen = len(self.path) + 1
187 188 l = []
188 189 if os.path.isdir(path):
189 190 visit = [path]
190 191 while visit:
191 192 p = visit.pop()
192 193 for f, kind, st in osutil.listdir(p, stat=True):
193 fp = self.pathjoiner(p, f)
194 fp = p + '/' + f
194 195 if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'):
195 196 n = util.pconvert(fp[striplen:])
196 197 l.append((decodedir(n), n, st.st_size))
@@ -217,9 +218,8 b' class basicstore(object):'
217 218 pass
218 219
219 220 class encodedstore(basicstore):
220 def __init__(self, path, opener, pathjoiner):
221 self.pathjoiner = pathjoiner
222 self.path = self.pathjoiner(path, 'store')
221 def __init__(self, path, opener):
222 self.path = path + '/store'
223 223 self.createmode = _calcmode(self.path)
224 224 op = opener(self.path)
225 225 op.createmode = self.createmode
@@ -234,11 +234,11 b' class encodedstore(basicstore):'
234 234 yield a, b, size
235 235
236 236 def join(self, f):
237 return self.pathjoiner(self.path, encodefilename(f))
237 return self.path + '/' + encodefilename(f)
238 238
239 239 def copylist(self):
240 240 return (['requires', '00changelog.i'] +
241 [self.pathjoiner('store', f) for f in _data.split()])
241 ['store/' + f for f in _data.split()])
242 242
243 243 class fncache(object):
244 244 # the filename used to be partially encoded
@@ -299,10 +299,9 b' class fncache(object):'
299 299 return iter(self.entries)
300 300
301 301 class fncachestore(basicstore):
302 def __init__(self, path, opener, pathjoiner, encode):
302 def __init__(self, path, opener, encode):
303 303 self.encode = encode
304 self.pathjoiner = pathjoiner
305 self.path = self.pathjoiner(path, 'store')
304 self.path = path + '/store'
306 305 self.createmode = _calcmode(self.path)
307 306 op = opener(self.path)
308 307 op.createmode = self.createmode
@@ -316,17 +315,16 b' class fncachestore(basicstore):'
316 315 self.opener = fncacheopener
317 316
318 317 def join(self, f):
319 return self.pathjoiner(self.path, self.encode(f))
318 return self.path + '/' + self.encode(f)
320 319
321 320 def datafiles(self):
322 321 rewrite = False
323 322 existing = []
324 pjoin = self.pathjoiner
325 323 spath = self.path
326 324 for f in self.fncache:
327 325 ef = self.encode(f)
328 326 try:
329 st = os.stat(pjoin(spath, ef))
327 st = os.stat(spath + '/' + ef)
330 328 yield f, ef, st.st_size
331 329 existing.append(f)
332 330 except OSError:
@@ -341,17 +339,16 b' class fncachestore(basicstore):'
341 339 d = ('data dh fncache'
342 340 ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i')
343 341 return (['requires', '00changelog.i'] +
344 [self.pathjoiner('store', f) for f in d.split()])
342 ['store/' + f for f in d.split()])
345 343
346 344 def write(self):
347 345 self.fncache.write()
348 346
349 def store(requirements, path, opener, pathjoiner=None):
350 pathjoiner = pathjoiner or os.path.join
347 def store(requirements, path, opener):
351 348 if 'store' in requirements:
352 349 if 'fncache' in requirements:
353 350 auxencode = lambda f: _auxencode(f, 'dotencode' in requirements)
354 351 encode = lambda f: _hybridencode(f, auxencode)
355 return fncachestore(path, opener, pathjoiner, encode)
356 return encodedstore(path, opener, pathjoiner)
357 return basicstore(path, opener, pathjoiner)
352 return fncachestore(path, opener, encode)
353 return encodedstore(path, opener)
354 return basicstore(path, opener)
General Comments 0
You need to be logged in to leave comments. Login now