##// END OF EJS Templates
branchcache: change the _delayed flag to an explicit `_dirty` flag...
marmoute -
r52381:94f82149 default
parent child Browse files
Show More
@@ -74,7 +74,7 b' class BranchMapCache:'
74 disk.
74 disk.
75
75
76 If a transaction is in progress, the writing is schedule to transaction
76 If a transaction is in progress, the writing is schedule to transaction
77 close. See the `BranchMapCache.write_delayed` method.
77 close. See the `BranchMapCache.write_dirty` method.
78
78
79 This method exist independently of __getitem__ as it is sometime useful
79 This method exist independently of __getitem__ as it is sometime useful
80 to signal that we have no intend to use the data in memory yet.
80 to signal that we have no intend to use the data in memory yet.
@@ -164,13 +164,13 b' class BranchMapCache:'
164 def clear(self):
164 def clear(self):
165 self._per_filter.clear()
165 self._per_filter.clear()
166
166
167 def write_delayed(self, repo):
167 def write_dirty(self, repo):
168 unfi = repo.unfiltered()
168 unfi = repo.unfiltered()
169 for filtername in repoviewutil.get_ordered_subset():
169 for filtername in repoviewutil.get_ordered_subset():
170 cache = self._per_filter.get(filtername)
170 cache = self._per_filter.get(filtername)
171 if cache is None:
171 if cache is None:
172 continue
172 continue
173 if cache._delayed:
173 if cache._dirty:
174 if filtername is None:
174 if filtername is None:
175 repo = unfi
175 repo = unfi
176 else:
176 else:
@@ -433,13 +433,13 b' class branchcache(_BaseBranchCache):'
433 has a given node or not. If it's not provided, we assume that every node
433 has a given node or not. If it's not provided, we assume that every node
434 we have exists in changelog"""
434 we have exists in changelog"""
435 self._filtername = repo.filtername
435 self._filtername = repo.filtername
436 self._delayed = False
437 if tipnode is None:
436 if tipnode is None:
438 self.tipnode = repo.nullid
437 self.tipnode = repo.nullid
439 else:
438 else:
440 self.tipnode = tipnode
439 self.tipnode = tipnode
441 self.tiprev = tiprev
440 self.tiprev = tiprev
442 self.filteredhash = filteredhash
441 self.filteredhash = filteredhash
442 self._dirty = False
443
443
444 super().__init__(repo=repo, entries=entries, closed_nodes=closednodes)
444 super().__init__(repo=repo, entries=entries, closed_nodes=closednodes)
445 # closednodes is a set of nodes that close their branch. If the branch
445 # closednodes is a set of nodes that close their branch. If the branch
@@ -568,7 +568,7 b' class branchcache(_BaseBranchCache):'
568 )
568 )
569 # we copy will likely schedule a write anyway, but that does not seems
569 # we copy will likely schedule a write anyway, but that does not seems
570 # to hurt to overschedule
570 # to hurt to overschedule
571 other._delayed = self._delayed
571 other._dirty = self._dirty
572 # also copy information about the current verification state
572 # also copy information about the current verification state
573 other._verifiedbranches = set(self._verifiedbranches)
573 other._verifiedbranches = set(self._verifiedbranches)
574 return other
574 return other
@@ -583,7 +583,6 b' class branchcache(_BaseBranchCache):'
583 # Avoid premature writing.
583 # Avoid premature writing.
584 #
584 #
585 # (The cache warming setup by localrepo will update the file later.)
585 # (The cache warming setup by localrepo will update the file later.)
586 self._delayed = True
587 return
586 return
588 try:
587 try:
589 filename = self._filename(repo)
588 filename = self._filename(repo)
@@ -597,7 +596,7 b' class branchcache(_BaseBranchCache):'
597 len(self._entries),
596 len(self._entries),
598 nodecount,
597 nodecount,
599 )
598 )
600 self._delayed = False
599 self._dirty = False
601 except (IOError, OSError, error.Abort) as inst:
600 except (IOError, OSError, error.Abort) as inst:
602 # Abort may be raised by read only opener, so log and continue
601 # Abort may be raised by read only opener, so log and continue
603 repo.ui.debug(
602 repo.ui.debug(
@@ -707,7 +706,7 b' class branchcache(_BaseBranchCache):'
707 self.filteredhash = scmutil.filteredhash(
706 self.filteredhash = scmutil.filteredhash(
708 repo, self.tiprev, needobsolete=True
707 repo, self.tiprev, needobsolete=True
709 )
708 )
710
709 self._dirty = True
711 self.write(repo)
710 self.write(repo)
712
711
713
712
@@ -2974,7 +2974,7 b' class localrepository:'
2974 self._branchcaches.update_disk(filtered)
2974 self._branchcaches.update_disk(filtered)
2975
2975
2976 # flush all possibly delayed write.
2976 # flush all possibly delayed write.
2977 self._branchcaches.write_delayed(self)
2977 self._branchcaches.write_dirty(self)
2978
2978
2979 def invalidatecaches(self):
2979 def invalidatecaches(self):
2980 if '_tagscache' in vars(self):
2980 if '_tagscache' in vars(self):
General Comments 0
You need to be logged in to leave comments. Login now