comparison mercurial/help.py @ 49628:f09bc2ed9100 stable

help: fix a py3 error interpolating Set into b'%s' I can't reproduce it, but a coworker hit this with `hg help -v` with 6.2.3: ... File "mercurial\help.pyc", line 865, in helplist TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'set' I can confirm that the original expression fails in `hg debugshell`, and the new one works. The second instance was found by searching for "%s", but PyCharm detects a lot of variables as Any type, so I have no idea if there are other lurking problems.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 20 Nov 2022 15:55:27 -0500
parents 04e6add9e4dc
children f56873a7284c
comparison
equal deleted inserted replaced
49626:3324f39460e5 49628:f09bc2ed9100
862 # Check that all categories have an order. 862 # Check that all categories have an order.
863 missing_order = set(cats.keys()) - set(CATEGORY_ORDER) 863 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
864 if missing_order: 864 if missing_order:
865 ui.develwarn( 865 ui.develwarn(
866 b'help categories missing from CATEGORY_ORDER: %s' 866 b'help categories missing from CATEGORY_ORDER: %s'
867 % missing_order 867 % stringutil.forcebytestr(missing_order)
868 ) 868 )
869 869
870 # List per category. 870 # List per category.
871 for cat in CATEGORY_ORDER: 871 for cat in CATEGORY_ORDER:
872 catfns = cats.get(cat, []) 872 catfns = cats.get(cat, [])
895 # Check that all categories have an order. 895 # Check that all categories have an order.
896 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER) 896 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
897 if missing_order: 897 if missing_order:
898 ui.develwarn( 898 ui.develwarn(
899 b'help categories missing from TOPIC_CATEGORY_ORDER: %s' 899 b'help categories missing from TOPIC_CATEGORY_ORDER: %s'
900 % missing_order 900 % stringutil.forcebytestr(missing_order)
901 ) 901 )
902 902
903 # Output topics per category. 903 # Output topics per category.
904 for cat in TOPIC_CATEGORY_ORDER: 904 for cat in TOPIC_CATEGORY_ORDER:
905 topics = topiccats.get(cat, []) 905 topics = topiccats.get(cat, [])