##// END OF EJS Templates
revset: use phasecache.getrevset to calculate public()...
Jun Wu -
r35331:0c1aff6d default
parent child Browse files
Show More
@@ -208,7 +208,7 b' class phasecache(object):'
208 self.filterunknown(repo)
208 self.filterunknown(repo)
209 self.opener = repo.svfs
209 self.opener = repo.svfs
210
210
211 def getrevset(self, repo, phases):
211 def getrevset(self, repo, phases, subset=None):
212 """return a smartset for the given phases"""
212 """return a smartset for the given phases"""
213 self.loadphaserevs(repo) # ensure phase's sets are loaded
213 self.loadphaserevs(repo) # ensure phase's sets are loaded
214 phases = set(phases)
214 phases = set(phases)
@@ -222,7 +222,10 b' class phasecache(object):'
222 revs = set.union(*[self._phasesets[p] for p in phases])
222 revs = set.union(*[self._phasesets[p] for p in phases])
223 if repo.changelog.filteredrevs:
223 if repo.changelog.filteredrevs:
224 revs = revs - repo.changelog.filteredrevs
224 revs = revs - repo.changelog.filteredrevs
225 return smartset.baseset(revs)
225 if subset is None:
226 return smartset.baseset(revs)
227 else:
228 return subset & smartset.baseset(revs)
226 else:
229 else:
227 phases = set(allphases).difference(phases)
230 phases = set(allphases).difference(phases)
228 if not phases:
231 if not phases:
@@ -232,9 +235,11 b' class phasecache(object):'
232 revs = self._phasesets[p]
235 revs = self._phasesets[p]
233 else:
236 else:
234 revs = set.union(*[self._phasesets[p] for p in phases])
237 revs = set.union(*[self._phasesets[p] for p in phases])
238 if subset is None:
239 subset = smartset.fullreposet(repo)
235 if not revs:
240 if not revs:
236 return smartset.fullreposet(repo)
241 return subset
237 return smartset.fullreposet(repo).filter(lambda r: r not in revs)
242 return subset.filter(lambda r: r not in revs)
238
243
239 def copy(self):
244 def copy(self):
240 # Shallow copy meant to ensure isolation in
245 # Shallow copy meant to ensure isolation in
@@ -1504,8 +1504,7 b' def parents(repo, subset, x):'
1504
1504
1505 def _phase(repo, subset, *targets):
1505 def _phase(repo, subset, *targets):
1506 """helper to select all rev in <targets> phases"""
1506 """helper to select all rev in <targets> phases"""
1507 s = repo._phasecache.getrevset(repo, targets)
1507 return repo._phasecache.getrevset(repo, targets, subset)
1508 return subset & s
1509
1508
1510 @predicate('draft()', safe=True)
1509 @predicate('draft()', safe=True)
1511 def draft(repo, subset, x):
1510 def draft(repo, subset, x):
@@ -1612,11 +1611,7 b' def public(repo, subset, x):'
1612 """Changeset in public phase."""
1611 """Changeset in public phase."""
1613 # i18n: "public" is a keyword
1612 # i18n: "public" is a keyword
1614 getargs(x, 0, 0, _("public takes no arguments"))
1613 getargs(x, 0, 0, _("public takes no arguments"))
1615 phase = repo._phasecache.phase
1614 return _phase(repo, subset, phases.public)
1616 target = phases.public
1617 condition = lambda r: phase(repo, r) == target
1618 return subset.filter(condition, condrepr=('<phase %r>', target),
1619 cache=False)
1620
1615
1621 @predicate('remote([id [,path]])', safe=False)
1616 @predicate('remote([id [,path]])', safe=False)
1622 def remote(repo, subset, x):
1617 def remote(repo, subset, x):
General Comments 0
You need to be logged in to leave comments. Login now