Patchwork [3,of,5] merge: show number of ancestors in bid merge debug notes

login
register
mail settings
Submitter Pulkit Goyal
Date Sept. 11, 2020, 7:05 a.m.
Message ID <4e5bb80a831d8201e340.1599807931@workspace>
Download mbox | patch
Permalink /patch/47133/
State Accepted
Headers show

Comments

Pulkit Goyal - Sept. 11, 2020, 7:05 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1598442862 -19800
#      Wed Aug 26 17:24:22 2020 +0530
# Node ID 4e5bb80a831d8201e3407cf78721b8d2d236b74d
# Parent  76753724e6b5453d9540c73b1a1a6f11de818e46
# EXP-Topic merge-newnode
merge: show number of ancestors in bid merge debug notes

A good number of times, we don't generate an action for a file in
manifestmerge() which can result in bid merge doing the wrong thing.

Mentioning the number of ancestors from which we are bidding will help spot such
cases where we are not returning an action.

Differential Revision: https://phab.mercurial-scm.org/D8967

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1151,7 +1151,10 @@  def calculateupdates(
 
         # Call for bids
         # Pick the best bid for each file
-        repo.ui.note(_(b'\nauction for merging merge bids\n'))
+        repo.ui.note(
+            _(b'\nauction for merging merge bids (%d ancestors)\n')
+            % len(ancestors)
+        )
         mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
             repo.ui.note(_(b" %s:\n   list of bids:\n") % f)
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
@@ -149,7 +149,7 @@  Redo merge with merge.preferancestor="*"
    f1: versions differ -> m
    f2: remote unchanged -> k
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -200,7 +200,7 @@  The other way around:
    f1: versions differ -> m
    f2: remote is newer -> g
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote unchanged -> k
@@ -246,7 +246,7 @@  Verify how the output looks and and how 
   calculating bids for ancestor 40663881a6dd
   resolving manifests
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -281,7 +281,7 @@  Verify how the output looks and and how 
    f1: versions differ -> m
    f2: remote unchanged -> k
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -375,7 +375,7 @@  http://stackoverflow.com/questions/93500
   calculating bids for ancestor b211bbc6eb3c
   resolving manifests
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    x:
      list of bids:
        versions differ -> m
@@ -463,7 +463,7 @@  Verify that the old context ancestor wor
    d1/b: other deleted -> r
    d2/b: remote created -> g
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    d1/a:
      list of bids:
        other deleted -> r