diff -r 741e5d7f282d -r 362740e05460 mercurial/templater.py --- a/mercurial/templater.py Sun Oct 23 14:05:23 2016 +0900 +++ b/mercurial/templater.py Tue Oct 25 21:49:30 2016 +0900 @@ -837,7 +837,10 @@ # i18n: "shortest" is a keyword _("shortest() expects an integer minlength")) - cl = mapping['ctx']._repo.changelog + # _partialmatch() of filtered changelog could take O(len(repo)) time, + # which would be unacceptably slow. so we look for hash collision in + # unfiltered space, which means some hashes may be slightly longer. + cl = mapping['ctx']._repo.unfiltered().changelog def isvalid(test): try: if cl._partialmatch(test) is None: