# HG changeset patch # User Martin von Zweigbergk # Date 2020-02-28 19:32:02 # Node ID 6a34e438461bd1dd8b07c56ca8af30bbf5a7772c # Parent 09f3e003fc2a694f672b01ca4cdf21127a6e8e76 commit: clear resolved mergestate even if working copy is clean If the mergestate has resolved conflicts and a commit is successfully created (either because there are changes in the working copy or because ui.allowemptycommit=yes), we will also clear the merge state. However, if the working copy is clean (and ui.allowemptycommit=no), we leave the mergestate there. The user may notice it in `hg resolve -l` output (but not in `hg status -v` output). It's not clear how the user should clear it, but probably via `hg co -C .`. It's also quite likely that they won't even notice it and it will get cleared by a later `hg commit` (of unrelated changes). This patch makes it so that `hg commit` also clears resolved merge conflicts even if the command doesn't end up writing a commit because the working copy was empty. That's probably a little weird (commands that abort should generally avoid changing the repo), but it still seems mostly harmless, and it reduces the risk of more bugs like https://bz.mercurial-scm.org/show_bug.cgi?id=5494. I just ran into a version of that bug in the Evolve extension and that's what triggered this series. Differential Revision: https://phab.mercurial-scm.org/D8196 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2956,6 +2956,7 @@ class localrepository(object): or self.ui.configbool(b'ui', b'allowemptycommit') ) if not allowemptycommit: + ms.reset() return None if merge and cctx.deleted(): diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -61,6 +61,9 @@ * `hg debugmergestate` output format changed. Let us know if that is causing you problems and we'll roll it back. + * Resolved merge conflicts are now cleared by `hg commit` even if the + working copy has no changes. + == Internal API Changes == 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 @@ -357,7 +357,6 @@ Try to make empty commit while there are nothing changed [1] $ hg resolve -l - R a Change/delete conflict is not allowed $ hg up -qC 3