Patchwork [V2] merge: show list of bids for each file in bid-merge in ui.debug()

login
register
mail settings
Submitter Pulkit Goyal
Date Sept. 14, 2020, 11:12 a.m.
Message ID <7f605a79653a170cbf02.1600081926@workspace>
Download mbox | patch
Permalink /patch/47154/
State Superseded
Headers show

Comments

Pulkit Goyal - Sept. 14, 2020, 11:12 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1598442653 -19800
#      Wed Aug 26 17:20:53 2020 +0530
# Node ID 7f605a79653a170cbf028192e1b2b5deb2f0d9b7
# Parent  d2b5a7659fff465286c7a1a451f0ebfe7118f251
# EXP-Topic merge-newnode
merge: show list of bids for each file in bid-merge in ui.debug()

Earlier, we were showing the list of bids only when we were ambiguously picking.
However, the cases where we unambiguously picked a side may not always be
correct and need to be fixed.

Having list of bids for all files will be helpful in debugging.

Differential Revision: https://phab.mercurial-scm.org/D8966
Yuya Nishihara - Sept. 14, 2020, 12:01 p.m.
On Mon, 14 Sep 2020 16:42:06 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1598442653 -19800
> #      Wed Aug 26 17:20:53 2020 +0530
> # Node ID 7f605a79653a170cbf028192e1b2b5deb2f0d9b7
> # Parent  d2b5a7659fff465286c7a1a451f0ebfe7118f251
> # EXP-Topic merge-newnode
> merge: show list of bids for each file in bid-merge in ui.debug()

> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -1157,6 +1157,10 @@ def calculateupdates(
>          )
>          mresult = mergeresult()
>          for f, bids in sorted(fbids.items()):
> +            repo.ui.debug(_(b" list of bids for %s:\n") % f)

no _() for debug prints.

> +            for m, l in sorted(bids.items()):
> +                for _f, args, msg in l:
> +                    repo.ui.debug(b'   %s -> %s\n' % (msg, m))

Nit: this loop can be gated by ui.debugflag.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1157,6 +1157,10 @@  def calculateupdates(
         )
         mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
+            repo.ui.debug(_(b" list of bids for %s:\n") % f)
+            for m, l in sorted(bids.items()):
+                for _f, args, msg in l:
+                    repo.ui.debug(b'   %s -> %s\n' % (msg, m))
             # bids is a mapping from action method to list af actions
             # Consensus?
             if len(bids) == 1:  # all bids are the same kind of method
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -150,7 +150,13 @@  Redo merge with merge.preferancestor="*"
    f2: remote unchanged -> k
   
   auction for merging merge bids (2 ancestors)
+   list of bids for f1:
+     remote is newer -> g
+     versions differ -> m
    f1: picking 'get' action
+   list of bids for f2:
+     remote unchanged -> k
+     versions differ -> m
    f2: picking 'keep' action
   end of auction
   
@@ -193,7 +199,13 @@  The other way around:
    f2: remote is newer -> g
   
   auction for merging merge bids (2 ancestors)
+   list of bids for f1:
+     remote unchanged -> k
+     versions differ -> m
    f1: picking 'keep' action
+   list of bids for f2:
+     remote is newer -> g
+     versions differ -> m
    f2: picking 'get' action
   end of auction
   
@@ -258,7 +270,13 @@  Verify how the output looks and and how 
    f2: remote unchanged -> k
   
   auction for merging merge bids (2 ancestors)
+   list of bids for f1:
+     remote is newer -> g
+     versions differ -> m
    f1: picking 'get' action
+   list of bids for f2:
+     remote unchanged -> k
+     versions differ -> m
    f2: picking 'keep' action
   end of auction
   
@@ -431,8 +449,15 @@  Verify that the old context ancestor wor
    d2/b: remote created -> g
   
   auction for merging merge bids (2 ancestors)
+   list of bids for d1/a:
+     other deleted -> r
    d1/a: consensus for r
+   list of bids for d1/b:
+     other deleted -> r
    d1/b: consensus for r
+   list of bids for d2/b:
+     remote created -> g
+     remote created -> g
    d2/b: consensus for g
   end of auction