narrowspec: validate patterns when loading and saving spec file
Patterns should be normalized and validated before being passed into
narrowspec.save(). Let's assert that by checking immediately before
writing the narrow spec file. And let's assert that patterns loaded
from the spec file also conform.
Differential Revision: https://phab.mercurial-scm.org/D4524
ancestor: use heapreplace() in place of heappop/heappush()
This should be slightly faster.
Overall perfancestors result::
cpython nginx mercurial
------------- ---------------- ---------------- ----------------
b6db2e80a9ce^ 0.103461 0.006303 0.035716
8eb2145ff0fb 0.192307 (x1.86) 0.012115 (x1.92) 0.052135 (x1.46)
this patch 0.139986 (x1.35) 0.006389 (x1.01) 0.037176 (x1.04)
ancestor: rename local aliases of heapq functions in _lazyancestorsiter()
The original names no longer look pretty. Just call them as heap*() instead.