commit: error out on unresolved files even if commit would be empty
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 28 Feb 2020 10:30:18 -0800
changeset 44409 f935b680860d
parent 44408 6cf92d6c0ad5
child 44410 c85d5fd1a5d9
commit: error out on unresolved files even if commit would be empty Differential Revision: https://phab.mercurial-scm.org/D8195
mercurial/localrepo.py
tests/test-update-branches.t
--- a/mercurial/localrepo.py	Fri Feb 28 10:49:13 2020 -0800
+++ b/mercurial/localrepo.py	Fri Feb 28 10:30:18 2020 -0800
@@ -2944,6 +2944,9 @@
                 self, status, text, user, date, extra
             )
 
+            ms = mergemod.mergestate.read(self)
+            mergeutil.checkunresolved(ms)
+
             # internal config: ui.allowemptycommit
             allowemptycommit = (
                 wctx.branch() != wctx.p1().branch()
@@ -2958,9 +2961,6 @@
             if merge and cctx.deleted():
                 raise error.Abort(_(b"cannot commit merge with missing files"))
 
-            ms = mergemod.mergestate.read(self)
-            mergeutil.checkunresolved(ms)
-
             if editor:
                 cctx._text = editor(self, cctx, subs)
             edited = text != cctx._text
--- a/tests/test-update-branches.t	Fri Feb 28 10:49:13 2020 -0800
+++ b/tests/test-update-branches.t	Fri Feb 28 10:30:18 2020 -0800
@@ -347,8 +347,8 @@
   $ hg revert -r . a
   $ rm a.orig
   $ hg ci -m empty
-  nothing changed
-  [1]
+  abort: unresolved merge conflicts (see 'hg help resolve')
+  [255]
   $ hg resolve -m a
   (no more unresolved files)
   $ hg resolve -l