@@ -237,10 +237,19 @@ class localrepository(object):
# (used by the filecache decorator)
#
# Maps a property name to its util.filecacheentry
self._filecache = {}
+ # hold sets of revision to be filtered
+ # should be cleared when something might have changed the filter value:
+ # - new changesets,
+ # - phase change,
+ # - new obsolescence marker,
+ # - working directory parent change,
+ # - bookmark changes
+ self.revsfiltercache = {}
+
def close(self):
pass
def _restrictcapabilities(self, caps):
return caps
@@ -1091,10 +1100,11 @@ class localrepository(object):
del self.__dict__['_tagscache']
self.unfiltered()._branchcache = None # in UTF-8
self.unfiltered()._branchcachetip = None
obsolete.clearobscaches(self)
+ self.revsfiltercache.clear()
def invalidatedirstate(self):
'''Invalidates the dirstate, causing the next call to dirstate
to check if it was modified since the last time it was read,
rereading it if it has.
@@ -1856,10 +1866,11 @@ class localrepository(object):
tr = self.transaction(trname)
for key in sorted(remoteobs, reverse=True):
if key.startswith('dump'):
data = base85.b85decode(remoteobs[key])
self.obsstore.mergemarkers(tr, data)
+ self.revsfiltercache.clear()
if tr is not None:
tr.close()
finally:
if tr is not None:
tr.release()
@@ -2468,10 +2479,11 @@ class localrepository(object):
self.ui.status(_("added %d changesets"
" with %d changes to %d files%s\n")
% (changesets, revisions, files, htext))
obsolete.clearobscaches(self)
+ self.revsfiltercache.clear()
if changesets > 0:
p = lambda: cl.writepending() and self.root or ""
self.hook('pretxnchangegroup', throw=True,
node=hex(cl.node(clstart)), source=srctype,
@@ -736,8 +736,9 @@ def createmarkers(repo, relations, flag=
nprec = prec.node()
nsucs = tuple(s.node() for s in sucs)
if nprec in nsucs:
raise util.Abort("changeset %s cannot obsolete itself" % prec)
repo.obsstore.create(tr, nprec, nsucs, flag, metadata)
+ repo.revsfiltercache.clear()
tr.close()
finally:
tr.release()
@@ -247,10 +247,11 @@ class phasecache(object):
delroots.extend(olds - roots)
# declare deleted root in the target phase
if targetphase != 0:
self.retractboundary(repo, targetphase, delroots)
obsolete.clearobscaches(repo)
+ repo.revsfiltercache.clear()
def retractboundary(self, repo, targetphase, nodes):
# Be careful to preserve shallow-copied values: do not update
# phaseroots values, replace them.
@@ -265,10 +266,11 @@ class phasecache(object):
currentroots.update(newroots)
ctxs = repo.set('roots(%ln::)', currentroots)
currentroots.intersection_update(ctx.node() for ctx in ctxs)
self._updateroots(targetphase, currentroots)
obsolete.clearobscaches(repo)
+ repo.revsfiltercache.clear()
def advanceboundary(repo, targetphase, nodes):
"""Add nodes to a phase changing other nodes phases if necessary.
This function move boundary *forward* this means that all nodes
@@ -11,11 +11,14 @@ import copy
# function to compute filtered set
computefiltered = {}
def filteredrevs(repo, filtername):
"""returns set of filtered revision for this filter name"""
- return computefiltered[filtername](repo.unfiltered())
+ if filtername not in repo.revsfiltercache:
+ func = computefiltered[filtername]
+ repo.revsfiltercache[filtername] = func(repo.unfiltered())
+ return repo.revsfiltercache[filtername]
class repoview(object):
"""Provide a read/write view of a repo through a filtered changelog
This object is used to access a filtered version of a repository without