From patchwork Thu Oct 10 09:50:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7039: py3-discovery: using plain str in stats dict From: phabricator X-Patchwork-Id: 42181 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 10 Oct 2019 09:50:17 +0000 gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY rust-cpython converts automatically from Rust strings to the appropriate `str` for the target Python version. Insisting on discovery stats dict keys to be bytes hence breaks the process (this is spotted by test-setdiscovery.t). Now that byteify-strings has been run on the entire codebase, and the import transformer is not there any more, the simplest fix is to make the keys plain str again. Another possible fix would be to forcefully convert to bytes in rust-cpython code, but that feels less natural, and would probably have to be reverted down the road. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D7039 AFFECTED FILES mercurial/setdiscovery.py CHANGE DETAILS To: gracinet, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -176,7 +176,7 @@ def stats(self): return { - b'undecided': len(self.undecided), + 'undecided': len(self.undecided), } def commonheads(self): @@ -441,7 +441,7 @@ stats = disco.stats() ui.debug( b"query %i; still undecided: %i, sample size is: %i\n" - % (roundtrips, stats[b'undecided'], len(sample)) + % (roundtrips, stats['undecided'], len(sample)) ) # indices between sample and externalized version must match