# HG changeset patch
# User Paul Morelle <paul.more...@octobus.net>
# Date 1526295914 -7200
#      Mon May 14 13:05:14 2018 +0200
# Node ID 7f059b2d62b30e1fd7ca86d00819395178c6a50b
# Parent  8ba0344f9fb145f5b9b909f1211defc9e0793f68
# EXP-Topic fallback-to-other-parent
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
7f059b2d62b3
revlog: for a delta, when a parent was refused, suggest other parent (issue5481)

Without aggressivemergedeltas, ensure that when we decline the closest parent
(by revision number), the other parent is examined too.

diff -r 8ba0344f9fb1 -r 7f059b2d62b3 mercurial/revlog.py
--- a/mercurial/revlog.py       Fri May 11 22:07:43 2018 -0400
+++ b/mercurial/revlog.py       Mon May 14 13:05:14 2018 +0200
@@ -326,12 +326,19 @@
                 # exclude already lazy tested base if any
                 parents = [p for p in (p1r, p2r)
                            if p != nullrev and p not in tested]
-                if parents and not revlog._aggressivemergedeltas:
-                    # Pick whichever parent is closer to us (to minimize the
-                    # chance of having to build a fulltext).
-                    parents = [max(parents)]
-                tested.update(parents)
-                yield parents
+
+                if not revlog._aggressivemergedeltas and len(parents) == 2:
+                    parents.sort()
+                    # To minimize the chance of having to build a fulltext,
+                    # pick first whichever parent is closest to us (max rev)
+                    yield (parents[1],)
+                    # then the other one (min rev) if the first did not fit
+                    yield (parents[0],)
+                    tested.update(parents)
+                elif len(parents) > 0:
+                    # Test all parents (1 or 2), and keep the best candidate
+                    yield parents
+                    tested.update(parents)
 
             if prev not in tested:
                 # other approach failed try against prev to hopefully save us a
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to