Loading the branches namespace is expensive since it calls headrevs()
which scans the entire changelog. Therefore add an option to skip the
namespace if we're not resolving default. This should be an no-op if named
branches are not used.
This removes the following cost resolving remote/master in smartlog:
60 \ _masterrev smartlog.py:426 61 | revsingle (2 times) scmutil.py:426 61 | revrange (2 times) scmutil.py:469 79 | anyrevs (3 times) localrepo.py:812 74 | matchany (3 times) revset.py:2163 71 | parse (6 times) revsetlang.py:535 71 | _parsewith (10 times) revsetlang.py:462 71 | parse (46 times) parser.py:78 70 | _advance (48 times) parser.py:33 71 | tokenize (281 times) revsetlang.py:66 70 | <genexpr> (6 times) revsetlang.py:97 70 | __contains__ (3 times) localrepo.py:761 72 | __getitem__ (39 times) localrepo.py:748 73 | __init__ (161 times) context.py:447 70 | singlenode (3 times) namespaces.py:97 58 | <lambda> (3 times) namespaces.py:55 58 | branchtip (3 times) localrepo.py:965 58 | branchmap (3 times) localrepo.py:953 58 | _branchmapupdatecache (3 times) perftweaks.py:105 57 | _branchmapupdate perftweaks.py:85 38 | headrevs changelog.py:336
Note: we cannot just reorder the namespaces since the revset string
smartlog(...) as a whole will be tested against each namespace.
How are tags affected by the code below?