diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2874,7 +2874,7 @@
                 self, status, text, user, date, extra
             )
 
-            ms = mergestatemod.mergestate.read(self)
+            ms = wctx.mergestate()
             mergeutil.checkunresolved(ms)
 
             # internal config: ui.allowemptycommit