# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@octobus.net>
# Date 1551918504 -3600
#      Thu Mar 07 01:28:24 2019 +0100
# Node ID b8c0855a41e76a76fcef367b75ad3b1844685428
# Parent  a05f0bbefdd961409bf77120a0f71d4ad8332785
# EXP-Topic discovery
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
b8c0855a41e7
discovery: clarify why the caching of children is valid

Yuya Nishihara pointed out that the code looks wrong without this clarification.
(And, unsurprisingly, Yuya is right)

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -175,6 +175,10 @@ class partialdiscovery(object):
     def _childrengetter(self):
 
         if self._childrenmap is not None:
+            # During discovery, the `undecided` set keep shrinking.
+            # Therefore, the map computed for an iteration N will be
+            # valid for iteration N+1. Instead of computing the same
+            # data over and over we cached it the first time.
             return self._childrenmap.__getitem__
 
         # _updatesample() essentially does interaction over revisions to look
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to