Show More
@@ -2504,6 +2504,9 b' class localrepository(object):' | |||||
2504 |
|
2504 | |||
2505 | if full: |
|
2505 | if full: | |
2506 | unfi = self.unfiltered() |
|
2506 | unfi = self.unfiltered() | |
|
2507 | ||||
|
2508 | self.changelog.update_caches(transaction=tr) | |||
|
2509 | ||||
2507 | rbc = unfi.revbranchcache() |
|
2510 | rbc = unfi.revbranchcache() | |
2508 | for r in unfi.changelog: |
|
2511 | for r in unfi.changelog: | |
2509 | rbc.branchinfo(r) |
|
2512 | rbc.branchinfo(r) |
@@ -748,6 +748,13 b' class revlog(object):' | |||||
748 | return False |
|
748 | return False | |
749 | return True |
|
749 | return True | |
750 |
|
750 | |||
|
751 | def update_caches(self, transaction): | |||
|
752 | if self.nodemap_file is not None: | |||
|
753 | if transaction is None: | |||
|
754 | nodemaputil.update_persistent_nodemap(self) | |||
|
755 | else: | |||
|
756 | nodemaputil.setup_persistent_nodemap(transaction, self) | |||
|
757 | ||||
751 | def clearcaches(self): |
|
758 | def clearcaches(self): | |
752 | self._revisioncache = None |
|
759 | self._revisioncache = None | |
753 | self._chainbasecache.clear() |
|
760 | self._chainbasecache.clear() |
@@ -73,10 +73,24 b' def setup_persistent_nodemap(tr, revlog)' | |||||
73 | callback_id = b"revlog-persistent-nodemap-%s" % revlog.nodemap_file |
|
73 | callback_id = b"revlog-persistent-nodemap-%s" % revlog.nodemap_file | |
74 | if tr.hasfinalize(callback_id): |
|
74 | if tr.hasfinalize(callback_id): | |
75 | return # no need to register again |
|
75 | return # no need to register again | |
76 | tr.addfinalize(callback_id, lambda tr: _persist_nodemap(tr, revlog)) |
|
76 | tr.addfinalize( | |
|
77 | callback_id, lambda tr: _persist_nodemap(tr.addpostclose, revlog) | |||
|
78 | ) | |||
77 |
|
79 | |||
78 |
|
80 | |||
79 |
def _persist_nodemap( |
|
81 | def update_persistent_nodemap(revlog): | |
|
82 | """update the persistent nodemap right now | |||
|
83 | ||||
|
84 | To be used for updating the nodemap on disk outside of a normal transaction | |||
|
85 | setup (eg, `debugupdatecache`). | |||
|
86 | """ | |||
|
87 | cleanups = [] | |||
|
88 | _persist_nodemap((lambda x, y: cleanups.append(y)), revlog) | |||
|
89 | for c in cleanups: | |||
|
90 | c(None) | |||
|
91 | ||||
|
92 | ||||
|
93 | def _persist_nodemap(cleaner, revlog): | |||
80 | """Write nodemap data on disk for a given revlog |
|
94 | """Write nodemap data on disk for a given revlog | |
81 | """ |
|
95 | """ | |
82 | if getattr(revlog, 'filteredrevs', ()): |
|
96 | if getattr(revlog, 'filteredrevs', ()): | |
@@ -163,7 +177,7 b' def _persist_nodemap(tr, revlog):' | |||||
163 | realvfs.tryunlink(oldfile) |
|
177 | realvfs.tryunlink(oldfile) | |
164 |
|
178 | |||
165 | callback_id = b"revlog-cleanup-nodemap-%s" % revlog.nodemap_file |
|
179 | callback_id = b"revlog-cleanup-nodemap-%s" % revlog.nodemap_file | |
166 |
|
|
180 | cleaner(callback_id, cleanup) | |
167 |
|
181 | |||
168 |
|
182 | |||
169 | ### Nodemap docket file |
|
183 | ### Nodemap docket file |
@@ -118,3 +118,22 b' Test code path without mmap' | |||||
118 | $ f --sha256 .hg/store/00changelog-*.nd --size |
|
118 | $ f --sha256 .hg/store/00changelog-*.nd --size | |
119 | .hg/store/00changelog-????????????????.nd: size=122944, sha256=755976b22b64ab680401b45395953504e64e7fa8c31ac570f58dee21e15f9bc0 (glob) |
|
119 | .hg/store/00changelog-????????????????.nd: size=122944, sha256=755976b22b64ab680401b45395953504e64e7fa8c31ac570f58dee21e15f9bc0 (glob) | |
120 | #endif |
|
120 | #endif | |
|
121 | ||||
|
122 | Test force warming the cache | |||
|
123 | ||||
|
124 | $ rm .hg/store/00changelog.n | |||
|
125 | $ hg debugnodemap --metadata | |||
|
126 | $ hg debugupdatecache | |||
|
127 | #if pure | |||
|
128 | $ hg debugnodemap --metadata | |||
|
129 | uid: ???????????????? (glob) | |||
|
130 | tip-rev: 5002 | |||
|
131 | data-length: 122944 | |||
|
132 | data-unused: 0 | |||
|
133 | #else | |||
|
134 | $ hg debugnodemap --metadata | |||
|
135 | uid: ???????????????? (glob) | |||
|
136 | tip-rev: 5002 | |||
|
137 | data-length: 122944 | |||
|
138 | data-unused: 0 | |||
|
139 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now