py3-discovery: using plain str in stats dict
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.
Differential Revision: https://phab.mercurial-scm.org/D7039
--- a/mercurial/setdiscovery.py Thu Oct 10 04:48:31 2019 +0200
+++ b/mercurial/setdiscovery.py Thu Oct 10 11:33:33 2019 +0200
@@ -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