diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5670,10 +5670,10 @@ def resolve(ui, repo, *pats, **opts): ui.setconfig('ui', 'forcemerge', '', 'resolve') ms.commit() - # replace filemerge's .orig file with our resolve file - # for files in tocomplete, ms.resolve will not overwrite - # .orig -- only preresolve does - util.rename(a + ".resolve", a + ".orig") + # replace filemerge's .orig file with our resolve file, but only + # for merges that are complete + if complete: + util.rename(a + ".resolve", a + ".orig") for f in tocomplete: try: @@ -5687,6 +5687,10 @@ def resolve(ui, repo, *pats, **opts): ui.setconfig('ui', 'forcemerge', '', 'resolve') ms.commit() + # replace filemerge's .orig file with our resolve file + a = repo.wjoin(f) + util.rename(a + ".resolve", a + ".orig") + ms.commit() if not didwork and pats: diff --git a/tests/test-resolve.t b/tests/test-resolve.t --- a/tests/test-resolve.t +++ b/tests/test-resolve.t @@ -207,6 +207,30 @@ resolve should re-merge file [1] $ grep '<<<' file1 > /dev/null +test .orig behavior with resolve + + $ echo resolve > file + $ hg resolve -q file1 --tool 'f --dump $TESTTMP/repo/file1.orig' + */file1~base*: (glob) + >>> + foo + <<< + */file1~other*: (glob) + >>> + foo + bar + <<< + $TESTTMP/repo/file1: (glob) + >>> + foo + baz + <<< + $TESTTMP/repo/file1.orig: (glob) + >>> + foo + baz + <<< + resolve should do nothing if 'file' was marked resolved $ echo resolved > file1 $ hg resolve -m file1