Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 44457:6a34e438461b
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 28 Feb 2020 11:32:02 -0800 |
parents | f935b680860d |
children | 6306baa7d19a |
comparison
equal
deleted
inserted
replaced
44456:09f3e003fc2a | 44457:6a34e438461b |
---|---|
2954 or merge | 2954 or merge |
2955 or cctx.files() | 2955 or cctx.files() |
2956 or self.ui.configbool(b'ui', b'allowemptycommit') | 2956 or self.ui.configbool(b'ui', b'allowemptycommit') |
2957 ) | 2957 ) |
2958 if not allowemptycommit: | 2958 if not allowemptycommit: |
2959 ms.reset() | |
2959 return None | 2960 return None |
2960 | 2961 |
2961 if merge and cctx.deleted(): | 2962 if merge and cctx.deleted(): |
2962 raise error.Abort(_(b"cannot commit merge with missing files")) | 2963 raise error.Abort(_(b"cannot commit merge with missing files")) |
2963 | 2964 |