# HG changeset patch # User Pierre-Yves David # Date 2019-03-07 00:28:24 # Node ID 3ba9ca537f57ecd37ff6f72926d0d8824dc5b0a8 # Parent 6a944bf4c43ad2174f021d790ada9770668188b7 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