diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1147,6 +1147,9 @@ class localrepository(repo.repository): and wctx.branch() == wctx.p1().branch()): return None + if merge and changes[3]: + raise util.Abort(_("cannot commit merge with missing files")) + ms = mergemod.mergestate(self) for f in changes[0]: if f in ms and ms[f] == 'u': diff --git a/tests/test-merge4.t b/tests/test-merge4.t --- a/tests/test-merge4.t +++ b/tests/test-merge4.t @@ -16,5 +16,10 @@ (branch merge, don't forget to commit) $ rm b $ echo This is file c22 > c + +Test hg behaves when committing with a missing file added by a merge + $ hg commit -m "commit #3" + abort: cannot commit merge with missing files + [255]