diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5283,7 +5283,7 @@ def resolve(ui, repo, *pats, **opts): try: ms = mergemod.mergestate(repo) - if not ms.active() and not show: + if not (ms.active() or repo.dirstate.p2() != nullid) and not show: raise util.Abort( _('resolve command not applicable when not merging')) diff --git a/tests/test-resolve.t b/tests/test-resolve.t --- a/tests/test-resolve.t +++ b/tests/test-resolve.t @@ -88,16 +88,14 @@ set up conflict-free merge 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) -BROKEN: resolve --all should do nothing in merge without conflicts +resolve --all should do nothing in merge without conflicts $ hg resolve --all - abort: resolve command not applicable when not merging - [255] + (no more unresolved files) -BROKEN: resolve -m should do nothing in merge without conflicts +resolve -m should do nothing in merge without conflicts $ hg resolve -m - abort: resolve command not applicable when not merging - [255] + (no more unresolved files) get back to conflicting state