# HG changeset patch # User Siddharth Agarwal # Date 1444633087 25200 # Node ID 36383507a6f8adb39df38fd20ca3bf5bc9d8ac25 # Parent 7955127efbcbd70b8219544f67a588f5fc6f38f3 resolve: perform all premerges before performing any file merges (BC) Just like the BC to merge before it, this allows for a maximally consistent state before providing any prompts to the user. diff -r 7955127efbcb -r 36383507a6f8 mercurial/commands.py --- a/mercurial/commands.py Sun Oct 11 23:56:44 2015 -0700 +++ b/mercurial/commands.py Sun Oct 11 23:58:07 2015 -0700 @@ -5568,6 +5568,7 @@ ret = 0 didwork = False + tocomplete = [] for f in ms: if not m(f): continue @@ -5586,21 +5587,35 @@ util.copyfile(a, a + ".resolve") try: - # resolve file + # preresolve file ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'resolve') complete, r = ms.preresolve(f, wctx) if not complete: - r = ms.resolve(f, wctx) - if r: + tocomplete.append(f) + elif r: ret = 1 finally: 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") + for f in tocomplete: + try: + # resolve file + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'resolve') + r = ms.resolve(f, wctx) + if r: + ret = 1 + finally: + ui.setconfig('ui', 'forcemerge', '', 'resolve') + ms.commit() + ms.commit() if not didwork and pats: diff -r 7955127efbcb -r 36383507a6f8 tests/test-resolve.t --- a/tests/test-resolve.t Sun Oct 11 23:56:44 2015 -0700 +++ b/tests/test-resolve.t Sun Oct 11 23:58:07 2015 -0700 @@ -135,8 +135,8 @@ resolve --all should re-merge all unresolved files $ hg resolve --all merging file1 + merging file2 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') - merging file2 warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') [1] $ cat file1.orig