commit: error out on unresolved files even if commit would be empty
Differential Revision: https://phab.mercurial-scm.org/D8195
--- 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