comparison mercurial/obsutil.py @ 51811:460e80488cf0

typing: lock in correct changes from pytype 2023.04.11 -> 2023.06.16 There were a handful of other changes to the pyi files generated when updating pytype locally (and jumping from python 3.8.0 to python 3.10.11), but they were not as clear (e.g. the embedded type in a list changing from `nothing` to `Any` or similar). These looked obviously correct, and agreed with PyCharm's thoughts on the signatures. Oddly, even though pytype starting inferring `obsutil._getfilteredreason()` as returning bytes, it (correctly) complained about the None path when it was typed that way. Instead, raise a ProgrammingError if an unhandled fate is calculated. (Currently, all possibilities are handled, so this isn't reachable unless another fate is added in the future.)
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 20 Aug 2024 18:30:47 -0400
parents ca7bde5dbafb
children f4733654f144
comparison
equal deleted inserted replaced
51810:f1ef512e14ab 51811:460e80488cf0
945 b"hidden revision '%s' was split as: %s and %d more" 945 b"hidden revision '%s' was split as: %s and %d more"
946 ), 946 ),
947 } 947 }
948 948
949 949
950 def _getfilteredreason(repo, changeid, ctx): 950 def _getfilteredreason(repo, changeid, ctx) -> bytes:
951 """return a human-friendly string on why a obsolete changeset is hidden""" 951 """return a human-friendly string on why a obsolete changeset is hidden"""
952 successors = successorssets(repo, ctx.node()) 952 successors = successorssets(repo, ctx.node())
953 fate = _getobsfate(successors) 953 fate = _getobsfate(successors)
954 954
955 # Be more precise in case the revision is superseded 955 # Be more precise in case the revision is superseded
972 firstsuccessors = b', '.join(succs[:2]) 972 firstsuccessors = b', '.join(succs[:2])
973 remainingnumber = len(succs) - 2 973 remainingnumber = len(succs) - 2
974 974
975 args = (changeid, firstsuccessors, remainingnumber) 975 args = (changeid, firstsuccessors, remainingnumber)
976 return filteredmsgtable[b'superseded_split_several'] % args 976 return filteredmsgtable[b'superseded_split_several'] % args
977 else:
978 raise error.ProgrammingError("unhandled fate: %r" % fate)
977 979
978 980
979 def divergentsets(repo, ctx): 981 def divergentsets(repo, ctx):
980 """Compute sets of commits divergent with a given one""" 982 """Compute sets of commits divergent with a given one"""
981 cache = {} 983 cache = {}