comparison mercurial/revset.py @ 16657:b6081c2c4647

phases: introduce phasecache The original motivation was changectx.phase() had special logic to correctly lookup in repo._phaserev, including invalidating it when necessary. And at other places, repo._phaserev was accessed directly. This led to the discovery that phases state including _phaseroots, _phaserev and _dirtyphase was manipulated in localrepository.py, phases.py, repair.py, etc. phasecache helps encapsulating that. This patch replaces all phase state in localrepo with phasecache and adjust related code except for advance/retractboundary() in phases. These still access to phasecache internals directly. This will be addressed in a followup.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 12 May 2012 00:24:07 +0200
parents 14913fcb30c6
children de4b42daf396
comparison
equal deleted inserted replaced
16656:4ae3ba9e4d7a 16657:b6081c2c4647
461 461
462 def draft(repo, subset, x): 462 def draft(repo, subset, x):
463 """``draft()`` 463 """``draft()``
464 Changeset in draft phase.""" 464 Changeset in draft phase."""
465 getargs(x, 0, 0, _("draft takes no arguments")) 465 getargs(x, 0, 0, _("draft takes no arguments"))
466 return [r for r in subset if repo._phaserev[r] == phases.draft] 466 pc = repo._phasecache
467 return [r for r in subset if pc.phase(repo, r) == phases.draft]
467 468
468 def filelog(repo, subset, x): 469 def filelog(repo, subset, x):
469 """``filelog(pattern)`` 470 """``filelog(pattern)``
470 Changesets connected to the specified filelog. 471 Changesets connected to the specified filelog.
471 """ 472 """
850 851
851 def public(repo, subset, x): 852 def public(repo, subset, x):
852 """``public()`` 853 """``public()``
853 Changeset in public phase.""" 854 Changeset in public phase."""
854 getargs(x, 0, 0, _("public takes no arguments")) 855 getargs(x, 0, 0, _("public takes no arguments"))
855 return [r for r in subset if repo._phaserev[r] == phases.public] 856 pc = repo._phasecache
857 return [r for r in subset if pc.phase(repo, r) == phases.public]
856 858
857 def remote(repo, subset, x): 859 def remote(repo, subset, x):
858 """``remote([id [,path]])`` 860 """``remote([id [,path]])``
859 Local revision that corresponds to the given identifier in a 861 Local revision that corresponds to the given identifier in a
860 remote repository, if present. Here, the '.' identifier is a 862 remote repository, if present. Here, the '.' identifier is a
1029 1031
1030 def secret(repo, subset, x): 1032 def secret(repo, subset, x):
1031 """``secret()`` 1033 """``secret()``
1032 Changeset in secret phase.""" 1034 Changeset in secret phase."""
1033 getargs(x, 0, 0, _("secret takes no arguments")) 1035 getargs(x, 0, 0, _("secret takes no arguments"))
1034 return [r for r in subset if repo._phaserev[r] == phases.secret] 1036 pc = repo._phasecache
1037 return [r for r in subset if pc.phase(repo, r) == phases.secret]
1035 1038
1036 def sort(repo, subset, x): 1039 def sort(repo, subset, x):
1037 """``sort(set[, [-]key...])`` 1040 """``sort(set[, [-]key...])``
1038 Sort set by keys. The default sort order is ascending, specify a key 1041 Sort set by keys. The default sort order is ascending, specify a key
1039 as ``-key`` to sort in descending order. 1042 as ``-key`` to sort in descending order.