comparison hgext/eol.py @ 13581:b30a488762e1 stable

eol: use dirstate methods to clear dirstate This fixes a race that was observed when status was called before and after clearing the dirstate.
author Martin Geisler <mg@lazybytes.net>
date Sat, 12 Mar 2011 12:11:09 +0100
parents 9b617c56eb65
children 358924b0abce 78cc35e75ecc
comparison
equal deleted inserted replaced
13575:8e94a1b4e9a4 13581:b30a488762e1
258 except OSError: 258 except OSError:
259 eolmtime = 0 259 eolmtime = 0
260 260
261 if eolmtime > cachemtime: 261 if eolmtime > cachemtime:
262 ui.debug("eol: detected change in .hgeol\n") 262 ui.debug("eol: detected change in .hgeol\n")
263 # TODO: we could introduce a method for this in dirstate.
264 wlock = None 263 wlock = None
265 try: 264 try:
266 wlock = self.wlock() 265 wlock = self.wlock()
267 for f, e in self.dirstate._map.iteritems(): 266 for f in self.dirstate:
268 self.dirstate._map[f] = (e[0], e[1], -1, 0) 267 if self.dirstate[f] == 'n':
269 self.dirstate._dirty = True 268 # all normal files need to be looked at
269 # again since the new .hgeol file might no
270 # longer match a file it matched before
271 self.dirstate.normallookup(f)
270 # Touch the cache to update mtime. 272 # Touch the cache to update mtime.
271 self.opener("eol.cache", "w").close() 273 self.opener("eol.cache", "w").close()
272 wlock.release() 274 wlock.release()
273 except error.LockUnavailable: 275 except error.LockUnavailable:
274 # If we cannot lock the repository and clear the 276 # If we cannot lock the repository and clear the