comparison mercurial/revset.py @ 23019:c8f32accd00a

revset-phases: prefetch attributes in phasesrelated revsets Pre-fetching attributes gives a significant performance boost. Such is Python. draft() 0) wall 0.011661 comb 0.010000 user 0.010000 sys 0.000000 (best of 205) 1) wall 0.009804 comb 0.000000 user 0.000000 sys 0.000000 (best of 231) draft() - ::bookmark() 0) wall 0.014173 comb 0.010000 user 0.010000 sys 0.000000 (best of 177) 1) wall 0.012966 comb 0.010000 user 0.010000 sys 0.000000 (best of 182)
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 16 Oct 2014 17:46:58 -0700
parents 73d9d5548dfe
children f2aeff8a87b6
comparison
equal deleted inserted replaced
23018:73d9d5548dfe 23019:c8f32accd00a
741 def draft(repo, subset, x): 741 def draft(repo, subset, x):
742 """``draft()`` 742 """``draft()``
743 Changeset in draft phase.""" 743 Changeset in draft phase."""
744 # i18n: "draft" is a keyword 744 # i18n: "draft" is a keyword
745 getargs(x, 0, 0, _("draft takes no arguments")) 745 getargs(x, 0, 0, _("draft takes no arguments"))
746 pc = repo._phasecache 746 phase = repo._phasecache.phase
747 condition = lambda r: pc.phase(repo, r) == phases.draft 747 target = phases.draft
748 condition = lambda r: phase(repo, r) == target
748 return subset.filter(condition, cache=False) 749 return subset.filter(condition, cache=False)
749 750
750 def extinct(repo, subset, x): 751 def extinct(repo, subset, x):
751 """``extinct()`` 752 """``extinct()``
752 Obsolete changesets with obsolete descendants only. 753 Obsolete changesets with obsolete descendants only.
1292 def public(repo, subset, x): 1293 def public(repo, subset, x):
1293 """``public()`` 1294 """``public()``
1294 Changeset in public phase.""" 1295 Changeset in public phase."""
1295 # i18n: "public" is a keyword 1296 # i18n: "public" is a keyword
1296 getargs(x, 0, 0, _("public takes no arguments")) 1297 getargs(x, 0, 0, _("public takes no arguments"))
1297 pc = repo._phasecache 1298 phase = repo._phasecache.phase
1298 condition = lambda r: pc.phase(repo, r) == phases.public 1299 target = phases.public
1300 condition = lambda r: phase(repo, r) == target
1299 return subset.filter(condition, cache=False) 1301 return subset.filter(condition, cache=False)
1300 1302
1301 def remote(repo, subset, x): 1303 def remote(repo, subset, x):
1302 """``remote([id [,path]])`` 1304 """``remote([id [,path]])``
1303 Local revision that corresponds to the given identifier in a 1305 Local revision that corresponds to the given identifier in a
1491 def secret(repo, subset, x): 1493 def secret(repo, subset, x):
1492 """``secret()`` 1494 """``secret()``
1493 Changeset in secret phase.""" 1495 Changeset in secret phase."""
1494 # i18n: "secret" is a keyword 1496 # i18n: "secret" is a keyword
1495 getargs(x, 0, 0, _("secret takes no arguments")) 1497 getargs(x, 0, 0, _("secret takes no arguments"))
1496 pc = repo._phasecache 1498 phase = repo._phasecache.phase
1497 condition = lambda x: pc.phase(repo, x) == phases.secret 1499 target = phases.secret
1500 condition = lambda r: phase(repo, r) == target
1498 return subset.filter(condition, cache=False) 1501 return subset.filter(condition, cache=False)
1499 1502
1500 def sort(repo, subset, x): 1503 def sort(repo, subset, x):
1501 """``sort(set[, [-]key...])`` 1504 """``sort(set[, [-]key...])``
1502 Sort set by keys. The default sort order is ascending, specify a key 1505 Sort set by keys. The default sort order is ascending, specify a key