Patchwork D8195: commit: error out on unresolved files even if commit would be empty

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2020, 7:58 p.m.
Message ID <differential-rev-PHID-DREV-bcih6aesz5ovht4i4xmy-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45408/
State Superseded
Headers show

Comments

phabricator - Feb. 28, 2020, 7:58 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8195

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-update-branches.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -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
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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