Show More
@@ -327,11 +327,11 b' class revlog(object):' | |||||
327 |
|
327 | |||
328 | self._indexfile = indexfile |
|
328 | self._indexfile = indexfile | |
329 | self._datafile = datafile |
|
329 | self._datafile = datafile | |
330 | self.nodemap_file = None |
|
330 | self._nodemap_file = None | |
331 | self.postfix = postfix |
|
331 | self.postfix = postfix | |
332 | self.opener = opener |
|
332 | self.opener = opener | |
333 | if persistentnodemap: |
|
333 | if persistentnodemap: | |
334 | self.nodemap_file = nodemaputil.get_nodemap_file(self) |
|
334 | self._nodemap_file = nodemaputil.get_nodemap_file(self) | |
335 |
|
335 | |||
336 | assert target[0] in ALL_KINDS |
|
336 | assert target[0] in ALL_KINDS | |
337 | assert len(target) == 2 |
|
337 | assert len(target) == 2 | |
@@ -536,14 +536,14 b' class revlog(object):' | |||||
536 | self._storedeltachains = True |
|
536 | self._storedeltachains = True | |
537 |
|
537 | |||
538 | devel_nodemap = ( |
|
538 | devel_nodemap = ( | |
539 | self.nodemap_file |
|
539 | self._nodemap_file | |
540 | and force_nodemap |
|
540 | and force_nodemap | |
541 | and parse_index_v1_nodemap is not None |
|
541 | and parse_index_v1_nodemap is not None | |
542 | ) |
|
542 | ) | |
543 |
|
543 | |||
544 | use_rust_index = False |
|
544 | use_rust_index = False | |
545 | if rustrevlog is not None: |
|
545 | if rustrevlog is not None: | |
546 | if self.nodemap_file is not None: |
|
546 | if self._nodemap_file is not None: | |
547 | use_rust_index = True |
|
547 | use_rust_index = True | |
548 | else: |
|
548 | else: | |
549 | use_rust_index = self.opener.options.get(b'rust.index') |
|
549 | use_rust_index = self.opener.options.get(b'rust.index') | |
@@ -562,7 +562,7 b' class revlog(object):' | |||||
562 | index, _chunkcache = d |
|
562 | index, _chunkcache = d | |
563 | use_nodemap = ( |
|
563 | use_nodemap = ( | |
564 | not self._inline |
|
564 | not self._inline | |
565 | and self.nodemap_file is not None |
|
565 | and self._nodemap_file is not None | |
566 | and util.safehasattr(index, 'update_nodemap_data') |
|
566 | and util.safehasattr(index, 'update_nodemap_data') | |
567 | ) |
|
567 | ) | |
568 | if use_nodemap: |
|
568 | if use_nodemap: | |
@@ -698,7 +698,7 b' class revlog(object):' | |||||
698 | return True |
|
698 | return True | |
699 |
|
699 | |||
700 | def update_caches(self, transaction): |
|
700 | def update_caches(self, transaction): | |
701 | if self.nodemap_file is not None: |
|
701 | if self._nodemap_file is not None: | |
702 | if transaction is None: |
|
702 | if transaction is None: | |
703 | nodemaputil.update_persistent_nodemap(self) |
|
703 | nodemaputil.update_persistent_nodemap(self) | |
704 | else: |
|
704 | else: | |
@@ -715,7 +715,7 b' class revlog(object):' | |||||
715 | # end up having to refresh it here. |
|
715 | # end up having to refresh it here. | |
716 | use_nodemap = ( |
|
716 | use_nodemap = ( | |
717 | not self._inline |
|
717 | not self._inline | |
718 | and self.nodemap_file is not None |
|
718 | and self._nodemap_file is not None | |
719 | and util.safehasattr(self.index, 'update_nodemap_data') |
|
719 | and util.safehasattr(self.index, 'update_nodemap_data') | |
720 | ) |
|
720 | ) | |
721 | if use_nodemap: |
|
721 | if use_nodemap: |
@@ -28,9 +28,9 b' class NodeMap(dict):' | |||||
28 |
|
28 | |||
29 | def persisted_data(revlog): |
|
29 | def persisted_data(revlog): | |
30 | """read the nodemap for a revlog from disk""" |
|
30 | """read the nodemap for a revlog from disk""" | |
31 | if revlog.nodemap_file is None: |
|
31 | if revlog._nodemap_file is None: | |
32 | return None |
|
32 | return None | |
33 | pdata = revlog.opener.tryread(revlog.nodemap_file) |
|
33 | pdata = revlog.opener.tryread(revlog._nodemap_file) | |
34 | if not pdata: |
|
34 | if not pdata: | |
35 | return None |
|
35 | return None | |
36 | offset = 0 |
|
36 | offset = 0 | |
@@ -77,11 +77,11 b' def setup_persistent_nodemap(tr, revlog)' | |||||
77 | """ |
|
77 | """ | |
78 | if revlog._inline: |
|
78 | if revlog._inline: | |
79 | return # inlined revlog are too small for this to be relevant |
|
79 | return # inlined revlog are too small for this to be relevant | |
80 | if revlog.nodemap_file is None: |
|
80 | if revlog._nodemap_file is None: | |
81 | return # we do not use persistent_nodemap on this revlog |
|
81 | return # we do not use persistent_nodemap on this revlog | |
82 |
|
82 | |||
83 | # we need to happen after the changelog finalization, in that use "cl-" |
|
83 | # we need to happen after the changelog finalization, in that use "cl-" | |
84 | callback_id = b"nm-revlog-persistent-nodemap-%s" % revlog.nodemap_file |
|
84 | callback_id = b"nm-revlog-persistent-nodemap-%s" % revlog._nodemap_file | |
85 | if tr.hasfinalize(callback_id): |
|
85 | if tr.hasfinalize(callback_id): | |
86 | return # no need to register again |
|
86 | return # no need to register again | |
87 | tr.addpending( |
|
87 | tr.addpending( | |
@@ -123,7 +123,7 b' def update_persistent_nodemap(revlog):' | |||||
123 | """ |
|
123 | """ | |
124 | if revlog._inline: |
|
124 | if revlog._inline: | |
125 | return # inlined revlog are too small for this to be relevant |
|
125 | return # inlined revlog are too small for this to be relevant | |
126 | if revlog.nodemap_file is None: |
|
126 | if revlog._nodemap_file is None: | |
127 | return # we do not use persistent_nodemap on this revlog |
|
127 | return # we do not use persistent_nodemap on this revlog | |
128 |
|
128 | |||
129 | notr = _NoTransaction() |
|
129 | notr = _NoTransaction() | |
@@ -133,11 +133,11 b' def update_persistent_nodemap(revlog):' | |||||
133 |
|
133 | |||
134 |
|
134 | |||
135 | def delete_nodemap(tr, repo, revlog): |
|
135 | def delete_nodemap(tr, repo, revlog): | |
136 | """Delete nodemap data on disk for a given revlog""" |
|
136 | """ Delete nodemap data on disk for a given revlog""" | |
137 | if revlog.nodemap_file is None: |
|
137 | if revlog._nodemap_file is None: | |
138 | msg = "calling persist nodemap on a revlog without the feature enabled" |
|
138 | msg = "calling persist nodemap on a revlog without the feature enabled" | |
139 | raise error.ProgrammingError(msg) |
|
139 | raise error.ProgrammingError(msg) | |
140 | repo.svfs.unlink(revlog.nodemap_file) |
|
140 | repo.svfs.unlink(revlog._nodemap_file) | |
141 |
|
141 | |||
142 |
|
142 | |||
143 | def persist_nodemap(tr, revlog, pending=False, force=False): |
|
143 | def persist_nodemap(tr, revlog, pending=False, force=False): | |
@@ -146,9 +146,9 b' def persist_nodemap(tr, revlog, pending=' | |||||
146 | raise error.ProgrammingError( |
|
146 | raise error.ProgrammingError( | |
147 | "cannot persist nodemap of a filtered changelog" |
|
147 | "cannot persist nodemap of a filtered changelog" | |
148 | ) |
|
148 | ) | |
149 | if revlog.nodemap_file is None: |
|
149 | if revlog._nodemap_file is None: | |
150 | if force: |
|
150 | if force: | |
151 | revlog.nodemap_file = get_nodemap_file(revlog) |
|
151 | revlog._nodemap_file = get_nodemap_file(revlog) | |
152 | else: |
|
152 | else: | |
153 | msg = "calling persist nodemap on a revlog without the feature enabled" |
|
153 | msg = "calling persist nodemap on a revlog without the feature enabled" | |
154 | raise error.ProgrammingError(msg) |
|
154 | raise error.ProgrammingError(msg) | |
@@ -225,7 +225,7 b' def persist_nodemap(tr, revlog, pending=' | |||||
225 | target_docket.tip_node = revlog.node(target_docket.tip_rev) |
|
225 | target_docket.tip_node = revlog.node(target_docket.tip_rev) | |
226 | # EXP-TODO: if this is a cache, this should use a cache vfs, not a |
|
226 | # EXP-TODO: if this is a cache, this should use a cache vfs, not a | |
227 | # store vfs |
|
227 | # store vfs | |
228 | file_path = revlog.nodemap_file |
|
228 | file_path = revlog._nodemap_file | |
229 | if pending: |
|
229 | if pending: | |
230 | file_path += b'.a' |
|
230 | file_path += b'.a' | |
231 | tr.registertmp(file_path) |
|
231 | tr.registertmp(file_path) | |
@@ -248,7 +248,7 b' def persist_nodemap(tr, revlog, pending=' | |||||
248 | for oldfile in olds: |
|
248 | for oldfile in olds: | |
249 | realvfs.tryunlink(oldfile) |
|
249 | realvfs.tryunlink(oldfile) | |
250 |
|
250 | |||
251 | callback_id = b"revlog-cleanup-nodemap-%s" % revlog.nodemap_file |
|
251 | callback_id = b"revlog-cleanup-nodemap-%s" % revlog._nodemap_file | |
252 | tr.addpostclose(callback_id, cleanup) |
|
252 | tr.addpostclose(callback_id, cleanup) | |
253 |
|
253 | |||
254 |
|
254 |
General Comments 0
You need to be logged in to leave comments.
Login now