##// END OF EJS Templates
eol: on update, only re-check files if filtering changed...
Mads Kiilerich -
r30140:747e546c default
parent child Browse files
Show More
@@ -312,10 +312,15 b' def reposetup(ui, repo):'
312 self._eolmatch = util.never
312 self._eolmatch = util.never
313 return
313 return
314
314
315 oldeol = None
315 try:
316 try:
316 cachemtime = os.path.getmtime(self.join("eol.cache"))
317 cachemtime = os.path.getmtime(self.join("eol.cache"))
317 except OSError:
318 except OSError:
318 cachemtime = 0
319 cachemtime = 0
320 else:
321 olddata = self.vfs.read("eol.cache")
322 if olddata:
323 oldeol = eolfile(self.ui, self.root, olddata)
319
324
320 try:
325 try:
321 eolmtime = os.path.getmtime(self.wjoin(".hgeol"))
326 eolmtime = os.path.getmtime(self.wjoin(".hgeol"))
@@ -324,17 +329,37 b' def reposetup(ui, repo):'
324
329
325 if eolmtime > cachemtime:
330 if eolmtime > cachemtime:
326 self.ui.debug("eol: detected change in .hgeol\n")
331 self.ui.debug("eol: detected change in .hgeol\n")
332
333 hgeoldata = self.wvfs.read('.hgeol')
334 neweol = eolfile(self.ui, self.root, hgeoldata)
335
327 wlock = None
336 wlock = None
328 try:
337 try:
329 wlock = self.wlock()
338 wlock = self.wlock()
330 for f in self.dirstate:
339 for f in self.dirstate:
331 if self.dirstate[f] == 'n':
340 if self.dirstate[f] != 'n':
332 # all normal files need to be looked at
341 continue
333 # again since the new .hgeol file might no
342 if oldeol is not None:
334 # longer match a file it matched before
343 if not oldeol.match(f) and not neweol.match(f):
335 self.dirstate.normallookup(f)
344 continue
336 # Create or touch the cache to update mtime
345 oldkey = None
337 self.vfs("eol.cache", "w").close()
346 for pattern, key, m in oldeol.patterns:
347 if m(f):
348 oldkey = key
349 break
350 newkey = None
351 for pattern, key, m in neweol.patterns:
352 if m(f):
353 newkey = key
354 break
355 if oldkey == newkey:
356 continue
357 # all normal files need to be looked at again since
358 # the new .hgeol file specify a different filter
359 self.dirstate.normallookup(f)
360 # Write the cache to update mtime and cache .hgeol
361 with self.vfs("eol.cache", "w") as f:
362 f.write(hgeoldata)
338 wlock.release()
363 wlock.release()
339 except error.LockUnavailable:
364 except error.LockUnavailable:
340 # If we cannot lock the repository and clear the
365 # If we cannot lock the repository and clear the
General Comments 0
You need to be logged in to leave comments. Login now