eol: use dirstate methods to clear dirstate stable
authorMartin Geisler <mg@lazybytes.net>
Sat, 12 Mar 2011 12:11:09 +0100
branchstable
changeset 13581 b30a488762e1
parent 13575 8e94a1b4e9a4
child 13583 e42d18538e1d
eol: use dirstate methods to clear dirstate This fixes a race that was observed when status was called before and after clearing the dirstate.
hgext/eol.py
--- a/hgext/eol.py	Thu Mar 10 11:30:38 2011 -0600
+++ b/hgext/eol.py	Sat Mar 12 12:11:09 2011 +0100
@@ -260,13 +260,15 @@
 
             if eolmtime > cachemtime:
                 ui.debug("eol: detected change in .hgeol\n")
-                # TODO: we could introduce a method for this in dirstate.
                 wlock = None
                 try:
                     wlock = self.wlock()
-                    for f, e in self.dirstate._map.iteritems():
-                        self.dirstate._map[f] = (e[0], e[1], -1, 0)
-                    self.dirstate._dirty = True
+                    for f in self.dirstate:
+                        if self.dirstate[f] == 'n':
+                            # all normal files need to be looked at
+                            # again since the new .hgeol file might no
+                            # longer match a file it matched before
+                            self.dirstate.normallookup(f)
                     # Touch the cache to update mtime.
                     self.opener("eol.cache", "w").close()
                     wlock.release()