hgext/eol.py
changeset 50151 092db6464321
parent 49997 981d2f132935
--- a/hgext/eol.py	Wed Feb 22 03:34:48 2023 +0100
+++ b/hgext/eol.py	Wed Feb 22 03:35:18 2023 +0100
@@ -421,31 +421,31 @@
                 wlock = None
                 try:
                     wlock = self.wlock()
-                    for f in self.dirstate:
-                        if not self.dirstate.get_entry(f).maybe_clean:
-                            continue
-                        if oldeol is not None:
-                            if not oldeol.match(f) and not neweol.match(f):
+                    with self.dirstate.changing_files(self):
+                        for f in self.dirstate:
+                            if not self.dirstate.get_entry(f).maybe_clean:
                                 continue
-                            oldkey = None
-                            for pattern, key, m in oldeol.patterns:
-                                if m(f):
-                                    oldkey = key
-                                    break
-                            newkey = None
-                            for pattern, key, m in neweol.patterns:
-                                if m(f):
-                                    newkey = key
-                                    break
-                            if oldkey == newkey:
-                                continue
-                        # all normal files need to be looked at again since
-                        # the new .hgeol file specify a different filter
-                        self.dirstate.set_possibly_dirty(f)
-                    # Write the cache to update mtime and cache .hgeol
-                    with self.vfs(b"eol.cache", b"w") as f:
-                        f.write(hgeoldata)
-                    self.dirstate.write(self.currenttransaction())
+                            if oldeol is not None:
+                                if not oldeol.match(f) and not neweol.match(f):
+                                    continue
+                                oldkey = None
+                                for pattern, key, m in oldeol.patterns:
+                                    if m(f):
+                                        oldkey = key
+                                        break
+                                newkey = None
+                                for pattern, key, m in neweol.patterns:
+                                    if m(f):
+                                        newkey = key
+                                        break
+                                if oldkey == newkey:
+                                    continue
+                            # all normal files need to be looked at again since
+                            # the new .hgeol file specify a different filter
+                            self.dirstate.set_possibly_dirty(f)
+                        # Write the cache to update mtime and cache .hgeol
+                        with self.vfs(b"eol.cache", b"w") as f:
+                            f.write(hgeoldata)
                 except errormod.LockUnavailable:
                     # If we cannot lock the repository and clear the
                     # dirstate, then a commit might not see all files