# HG changeset patch # User Pierre-Yves David # Date 1420590652 28800 # Node ID f82173a90c2c9d0d32216fe7243ec51fc6d44ff7 # Parent 4ef2f2fa8b8b27daf21375017f5646b3277d35cc setdiscovery: factorize similar sampling code We are using full sampling of 'fullsamplesize' in both case. The only difference is the debug message. So we factorise the sampling code and put the message in an extra conditional. This is going to help making changes around the sampling logic. Such changes are needed to improve discovery performance on highly headed repository. diff -r 4ef2f2fa8b8b -r f82173a90c2c mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py Tue Jan 06 16:30:37 2015 -0800 +++ b/mercurial/setdiscovery.py Tue Jan 06 16:30:52 2015 -0800 @@ -197,13 +197,11 @@ if not undecided: break - if full: - ui.note(_("sampling from both directions\n")) - sample = _takefullsample(dag, undecided, size=fullsamplesize) - targetsize = fullsamplesize - elif common.hasbases(): - # use cheapish initial sample - ui.debug("taking initial sample\n") + if full or common.hasbases(): + if full: + ui.note(_("sampling from both directions\n")) + else: + ui.debug("taking initial sample\n") sample = _takefullsample(dag, undecided, size=fullsamplesize) targetsize = fullsamplesize else: