comparison mercurial/localrepo.py @ 18105:312262ebc223

cache: group obscache and revsfiltercache invalidation in a single function Both caches are very volatile and needs invalidation on the same kind of event. revsfiltercache actually depends on the content of revsfiltercache.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 18 Dec 2012 02:04:37 +0100
parents a464deecc9dd
children 2cf01eb74842
comparison
equal deleted inserted replaced
18104:a2cebd3e4daa 18105:312262ebc223
1099 # can't use delattr on proxy 1099 # can't use delattr on proxy
1100 del self.__dict__['_tagscache'] 1100 del self.__dict__['_tagscache']
1101 1101
1102 self.unfiltered()._branchcache = None # in UTF-8 1102 self.unfiltered()._branchcache = None # in UTF-8
1103 self.unfiltered()._branchcachetip = None 1103 self.unfiltered()._branchcachetip = None
1104 self.invalidatevolatilesets()
1105
1106 def invalidatevolatilesets(self):
1107 self.filteredrevcache.clear()
1104 obsolete.clearobscaches(self) 1108 obsolete.clearobscaches(self)
1105 self.filteredrevcache.clear()
1106 1109
1107 def invalidatedirstate(self): 1110 def invalidatedirstate(self):
1108 '''Invalidates the dirstate, causing the next call to dirstate 1111 '''Invalidates the dirstate, causing the next call to dirstate
1109 to check if it was modified since the last time it was read, 1112 to check if it was modified since the last time it was read,
1110 rereading it if it has. 1113 rereading it if it has.
1866 tr = self.transaction(trname) 1869 tr = self.transaction(trname)
1867 for key in sorted(remoteobs, reverse=True): 1870 for key in sorted(remoteobs, reverse=True):
1868 if key.startswith('dump'): 1871 if key.startswith('dump'):
1869 data = base85.b85decode(remoteobs[key]) 1872 data = base85.b85decode(remoteobs[key])
1870 self.obsstore.mergemarkers(tr, data) 1873 self.obsstore.mergemarkers(tr, data)
1871 self.filteredrevcache.clear() 1874 self.invalidatevolatilesets()
1872 if tr is not None: 1875 if tr is not None:
1873 tr.close() 1876 tr.close()
1874 finally: 1877 finally:
1875 if tr is not None: 1878 if tr is not None:
1876 tr.release() 1879 tr.release()
2478 htext = _(" (%+d heads)") % dh 2481 htext = _(" (%+d heads)") % dh
2479 2482
2480 self.ui.status(_("added %d changesets" 2483 self.ui.status(_("added %d changesets"
2481 " with %d changes to %d files%s\n") 2484 " with %d changes to %d files%s\n")
2482 % (changesets, revisions, files, htext)) 2485 % (changesets, revisions, files, htext))
2483 obsolete.clearobscaches(self) 2486 self.invalidatevolatilesets()
2484 self.filteredrevcache.clear()
2485 2487
2486 if changesets > 0: 2488 if changesets > 0:
2487 p = lambda: cl.writepending() and self.root or "" 2489 p = lambda: cl.writepending() and self.root or ""
2488 self.hook('pretxnchangegroup', throw=True, 2490 self.hook('pretxnchangegroup', throw=True,
2489 node=hex(cl.node(clstart)), source=srctype, 2491 node=hex(cl.node(clstart)), source=srctype,