changeset 41894:3ba9ca537f57

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)
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 07 Mar 2019 01:28:24 +0100
parents 6a944bf4c43a
children 7da6307cc07a
files mercurial/setdiscovery.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Wed Mar 06 15:43:52 2019 -0800
+++ b/mercurial/setdiscovery.py	Thu Mar 07 01:28:24 2019 +0100
@@ -175,6 +175,10 @@
     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