comparison mercurial/localrepo.py @ 18394:5010448197bc

branchmap: update cache of 'unserved' filter on new changesets The `commitctx` and `addchangegroup` methods of repo upgrade branchcache after completion. This behavior aims to keep the branchcache in sync for read only process as hgweb. See ee317dbfb9d0 for details. Since changelog filtering is used, those calls only update the cache for unfiltered repo. One of no interest for typical read only process like hgweb. Note: By chance in basic case, `repo.unfiltered() == repo.filtered('unserved')` This changesets have the "unserved" cache updated instead. I think this is the only cache that matter for hgweb. We could imagine updating all possible branchcaches instead but: - I'm not sure it would have any benefit impact. It may even increase the odd of all cache being invalidated. - This is more complicated change. So I'm going for updating a single cache only which is already better that updating a cache nobody cares about. This changeset have a few expected impact on the testsuite are different cache are updated.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 16 Jan 2013 00:08:08 +0100
parents f3b21beb9802
children 904b7109938e
comparison
equal deleted inserted replaced
18393:a38039ef7312 18394:5010448197bc
1365 # be compliant anyway 1365 # be compliant anyway
1366 # 1366 #
1367 # if minimal phase was 0 we don't need to retract anything 1367 # if minimal phase was 0 we don't need to retract anything
1368 phases.retractboundary(self, targetphase, [n]) 1368 phases.retractboundary(self, targetphase, [n])
1369 tr.close() 1369 tr.close()
1370 branchmap.updatecache(self) 1370 branchmap.updatecache(self.filtered('served'))
1371 return n 1371 return n
1372 finally: 1372 finally:
1373 if tr: 1373 if tr:
1374 tr.release() 1374 tr.release()
1375 lock.release() 1375 lock.release()
2386 if changesets > 0: 2386 if changesets > 0:
2387 if srctype != 'strip': 2387 if srctype != 'strip':
2388 # During strip, branchcache is invalid but coming call to 2388 # During strip, branchcache is invalid but coming call to
2389 # `destroyed` will repair it. 2389 # `destroyed` will repair it.
2390 # In other case we can safely update cache on disk. 2390 # In other case we can safely update cache on disk.
2391 branchmap.updatecache(self) 2391 branchmap.updatecache(self.filtered('served'))
2392 def runhooks(): 2392 def runhooks():
2393 # forcefully update the on-disk branch cache 2393 # forcefully update the on-disk branch cache
2394 self.ui.debug("updating the branch cache\n") 2394 self.ui.debug("updating the branch cache\n")
2395 self.hook("changegroup", node=hex(cl.node(clstart)), 2395 self.hook("changegroup", node=hex(cl.node(clstart)),
2396 source=srctype, url=url) 2396 source=srctype, url=url)