Patchwork [stable] merge: more safe detection of criss cross merge conflict between dm and r

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 1, 2017, 1:13 a.m.
Message ID <086c37652735ca871173.1485911637@localhost.localdomain>
Download mbox | patch
Permalink /patch/18291/
State Accepted
Headers show

Comments

Mads Kiilerich - Feb. 1, 2017, 1:13 a.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1485911430 -3600
#      Wed Feb 01 02:10:30 2017 +0100
# Branch stable
# Node ID 086c37652735ca87117333fc71941bcb67b799c3
# Parent  2d6b86cadc1039f7cf72b64c29399bebe02e7dd3
merge: more safe detection of criss cross merge conflict between dm and r

41f6af50c0d8 introduced handling of a crash in this case. A review comment
suggested that it was not entirely obvious that a 'dm' always would have a 'r'
for the source file.

To mitigate that risk, make the code more conservative and make less
assumptions.
Yuya Nishihara - Feb. 1, 2017, 1:48 p.m.
On Wed, 01 Feb 2017 02:13:57 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads@kiilerich.com>
> # Date 1485911430 -3600
> #      Wed Feb 01 02:10:30 2017 +0100
> # Branch stable
> # Node ID 086c37652735ca87117333fc71941bcb67b799c3
> # Parent  2d6b86cadc1039f7cf72b64c29399bebe02e7dd3
> merge: more safe detection of criss cross merge conflict between dm and r
> 
> 41f6af50c0d8 introduced handling of a crash in this case. A review comment
> suggested that it was not entirely obvious that a 'dm' always would have a 'r'
> for the source file.
> 
> To mitigate that risk, make the code more conservative and make less
> assumptions.

Queued this for more obvious safety, thanks.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1039,8 +1039,7 @@  def calculateupdates(repo, wctx, mctx, a
         for f in dms:
             dm, (f0, flags), msg = actions[f]
             assert dm == 'dm', dm
-            m, args, msg = actions[f0]
-            if m == 'r':
+            if f0 in actions and actions[f0][0] == 'r':
                 # We have one bid for removing a file and another for moving it.
                 # These two could be merged as first move and then delete ...
                 # but instead drop moving and just delete.