2750 if tr is not None and tr.hookargs.get(b'source') == b'strip': |
2750 if tr is not None and tr.hookargs.get(b'source') == b'strip': |
2751 # During strip, many caches are invalid but |
2751 # During strip, many caches are invalid but |
2752 # later call to `destroyed` will refresh them. |
2752 # later call to `destroyed` will refresh them. |
2753 return |
2753 return |
2754 |
2754 |
2755 if tr is None or tr.changes[b'origrepolen'] < len(self): |
2755 unfi = self.unfiltered() |
2756 # accessing the 'served' branchmap should refresh all the others, |
|
2757 self.ui.debug(b'updating the branch cache\n') |
|
2758 self.filtered(b'served').branchmap() |
|
2759 self.filtered(b'served.hidden').branchmap() |
|
2760 |
2756 |
2761 if full: |
2757 if full: |
2762 unfi = self.unfiltered() |
2758 caches = repository.CACHES_ALL |
2763 |
2759 if full == b"post-clone": |
|
2760 caches = caches.copy() |
|
2761 caches.discard(repository.CACHE_FILE_NODE_TAGS) |
|
2762 else: |
|
2763 caches = repository.CACHES_DEFAULT |
|
2764 |
|
2765 if repository.CACHE_BRANCHMAP_SERVED in caches: |
|
2766 if tr is None or tr.changes[b'origrepolen'] < len(self): |
|
2767 # accessing the 'served' branchmap should refresh all the others, |
|
2768 self.ui.debug(b'updating the branch cache\n') |
|
2769 self.filtered(b'served').branchmap() |
|
2770 self.filtered(b'served.hidden').branchmap() |
|
2771 |
|
2772 if repository.CACHE_CHANGELOG_CACHE in caches: |
2764 self.changelog.update_caches(transaction=tr) |
2773 self.changelog.update_caches(transaction=tr) |
|
2774 |
|
2775 if repository.CACHE_MANIFESTLOG_CACHE in caches: |
2765 self.manifestlog.update_caches(transaction=tr) |
2776 self.manifestlog.update_caches(transaction=tr) |
2766 |
2777 |
|
2778 if repository.CACHE_REV_BRANCH in caches: |
2767 rbc = unfi.revbranchcache() |
2779 rbc = unfi.revbranchcache() |
2768 for r in unfi.changelog: |
2780 for r in unfi.changelog: |
2769 rbc.branchinfo(r) |
2781 rbc.branchinfo(r) |
2770 rbc.write() |
2782 rbc.write() |
2771 |
2783 |
|
2784 if repository.CACHE_FULL_MANIFEST in caches: |
2772 # ensure the working copy parents are in the manifestfulltextcache |
2785 # ensure the working copy parents are in the manifestfulltextcache |
2773 for ctx in self[b'.'].parents(): |
2786 for ctx in self[b'.'].parents(): |
2774 ctx.manifest() # accessing the manifest is enough |
2787 ctx.manifest() # accessing the manifest is enough |
2775 |
2788 |
2776 if not full == b"post-clone": |
2789 if repository.CACHE_FILE_NODE_TAGS in caches: |
2777 # accessing fnode cache warms the cache |
2790 # accessing fnode cache warms the cache |
2778 tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs()) |
2791 tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs()) |
|
2792 |
|
2793 if repository.CACHE_TAGS_DEFAULT in caches: |
2779 # accessing tags warm the cache |
2794 # accessing tags warm the cache |
2780 self.tags() |
2795 self.tags() |
|
2796 if repository.CACHE_TAGS_SERVED in caches: |
2781 self.filtered(b'served').tags() |
2797 self.filtered(b'served').tags() |
2782 |
2798 |
2783 # The `full` arg is documented as updating even the lazily-loaded |
2799 if repository.CACHE_BRANCHMAP_ALL in caches: |
2784 # caches immediately, so we're forcing a write to cause these caches |
2800 # The CACHE_BRANCHMAP_ALL updates lazily-loaded caches immediately, |
2785 # to be warmed up even if they haven't explicitly been requested |
2801 # so we're forcing a write to cause these caches to be warmed up |
2786 # yet (if they've never been used by hg, they won't ever have been |
2802 # even if they haven't explicitly been requested yet (if they've |
2787 # written, even if they're a subset of another kind of cache that |
2803 # never been used by hg, they won't ever have been written, even if |
2788 # *has* been used). |
2804 # they're a subset of another kind of cache that *has* been used). |
2789 for filt in repoview.filtertable.keys(): |
2805 for filt in repoview.filtertable.keys(): |
2790 filtered = self.filtered(filt) |
2806 filtered = self.filtered(filt) |
2791 filtered.branchmap().write(filtered) |
2807 filtered.branchmap().write(filtered) |
2792 |
2808 |
2793 def invalidatecaches(self): |
2809 def invalidatecaches(self): |