narrow: call narrowspec.{save,restore,clear}backup directly
I want to move .hg/narrowspec to .hg/store/narrowspec and we need to
decouple the narrowspec update from the dirstate update for that. This
patch lets the callers call the narrowspec backup functions directly,
in addition to the dirstate backup functions. The narrowspec methods
are made to check if narrowing is enabled. For that, a repo instance
was needed, which all the callers luckily already had available.
Differential Revision: https://phab.mercurial-scm.org/D4096
index: don't add 1 to length variables
A lot of "+ 1" and "-1" were mechanically added to ease the transition
in
781b2720d2ac (index: don't include nullid in len(),
2018-07-20). Let's clean it up now.
Differential Revision: https://phab.mercurial-scm.org/D4106
index: drop support for nullid at position len(index) in index_node
I think no callers exist since at least
a3dacabd476b (index: don't
allow index[len(index)] to mean nullid, 2018-07-20).
Differential Revision: https://phab.mercurial-scm.org/D4105
index: return False for "len(index) in index"
Since we no longer accept index[len(index)], we should clearly make
"len(index) in index" return False. This should have been part of
a3dacabd476b (index: don't allow index[len(index)] to mean nullid,
2018-07-20)
Differential Revision: https://phab.mercurial-scm.org/D4104
fileset: combine union of basic patterns into single matcher
This appears to improve query performance in a big repository than I thought.
Writing less Python in a hot loop, faster computation we gain.
$ hg files --cwd mozilla-central --time 'set:a* + b* + c* + d* + e*'
(orig) time: real 0.670 secs (user 0.640+0.000 sys 0.030+0.000)
(new) time: real 0.210 secs (user 0.180+0.000 sys 0.020+0.000)
fileset: introduce weight constants for readability
These constants are defined in the filesetlang module since it's the
bottommost module depending on WEIGHT_CHECK_FILENAME, and extensions
will be likely to import it to process function arguments.
Credit for the naming goes to Augie Fackler.