diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
index d7829b2ecf3274ca1b8306b993a38cf1b5c57ce3_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..3f75fb837638a2df5f5585b1f19cc56f51cd2a00_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -949,6 +949,7 @@
             self.store.write()
             if self._dirtyphases:
                 phases.writeroots(self)
+                self._dirtyphases = False
             for k, ce in self._filecache.items():
                 if k == 'dirstate':
                     continue