[PATCH 2 of 2 stable] merge: fix crash on criss cross merge with dir move and delete (issue5020)

Yuya Nishihara yuya at tcha.org
Tue Jan 31 09:49:29 EST 2017


On Tue, 31 Jan 2017 03:26:52 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1485829559 -3600
> #      Tue Jan 31 03:25:59 2017 +0100
> # Branch stable
> # Node ID 9aa0ed4d2693608c25112f0770809f5be1c8be1c
> # Parent  f1cb9a55f1ff7251d85ff60ff5a190c183f1a012
> merge: fix crash on criss cross merge with dir move and delete (issue5020)
> 
> Work around that 'dm' in the data model only can have one operation for the
> target file, but still can have multiple and conflicting operations on the
> source file where the other operation is a 'rm'. The move would thus fail with
> 'abort: No such file or directory'.
> 
> In this case it is "obvious" that the file should be removed, either before or
> after moving it. We thus keep the 'rm' of the source file but drop the 'dm'.

This 'dm'-vs-'r' story makes sense.

> @@ -1029,7 +1032,19 @@ def calculateupdates(repo, wctx, mctx, a
>              repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') %
>                           (f, m))
>              actions[f] = l[0]
> +            if m == 'dm':
> +                dms.append(f)
>              continue
> +        # Work around 'dm' that can cause multiple actions for the same file
> +        for f in dms:
> +            dm, (f0, flags), msg = actions[f]
> +            assert dm == 'dm', dm
> +            m, args, msg = actions[f0]

I was a bit worried whether actions[f0] always exist, but that seemed
unnecessary concern.

Queued the series, thanks.


More information about the Mercurial-devel mailing list