# HG changeset patch # User Martin von Zweigbergk # Date 2022-01-14 17:28:44 # Node ID 50de08904c632e835c0a715b68e68e274110696a # Parent 7ed4c47538919c0f3819f7b802cb880d180b43cb merge: consider the file merged when using :merge-{local,other} Returning `None` from `simplemerge()` means that the caller interprets it as "no merge was necessary (because two sides matched)". See 6217040b2780 and issue2680 for some background. However, `simplemerge()` shouldn't even get called in such scenarios, and returning `None` means that the file is not considered merged, even though the contents actually were. See the affected test cases. Differential Revision: https://phab.mercurial-scm.org/D11999 diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -483,7 +483,7 @@ def simplemerge(ui, localctx, basectx, o basetext = readctx(basectx) othertext = readctx(otherctx) except error.Abort: - return 1 + return True m3 = Merge3Text(basetext, localtext, othertext) conflicts = False @@ -511,5 +511,4 @@ def simplemerge(ui, localctx, basectx, o # mergestate.resolve()) localctx.write(mergedtext, localctx.flags()) - if conflicts: - return 1 + return conflicts diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -886,7 +886,7 @@ track of possible further descendants in created new head $ hg merge --tool :merge-other 24 merging baz - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m 'merge forgetting about baz rewrite' $ cat > baz << EOF diff --git a/tests/test-conflict.t b/tests/test-conflict.t --- a/tests/test-conflict.t +++ b/tests/test-conflict.t @@ -404,7 +404,7 @@ Now test :merge-other and :merge-local 1 other heads for branch "default" $ hg merge --tool :merge-local merging a - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat a Start of file diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t --- a/tests/test-copies-chain-merge.t +++ b/tests/test-copies-chain-merge.t @@ -463,14 +463,14 @@ Subcase: new copy information on both si 3 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg merge 'desc("q-2")' --tool ':union' merging v - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 1 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "mPQm-0 $case_desc - one way" $ hg up 'desc("q-2")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("p-2")' --tool ':union' merging v - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 1 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "mQPm-0 $case_desc - the other way" created new head @@ -626,14 +626,14 @@ consider history and rename on both bran 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("g-1")' --tool :union merging d - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "mDGm-0 $case_desc - one way" $ hg up 'desc("g-1")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("d-2")' --tool :union merging d - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "mGDm-0 $case_desc - the other way" created new head diff --git a/tests/test-merge-internal-tools-pattern.t b/tests/test-merge-internal-tools-pattern.t --- a/tests/test-merge-internal-tools-pattern.t +++ b/tests/test-merge-internal-tools-pattern.t @@ -130,7 +130,7 @@ Merge using internal:union tool: $ hg merge 3 merging f - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat f