##// END OF EJS Templates
nodemap: update the index with the newly written data (when appropriate)...
marmoute -
r44812:6ecc34b3 default
parent child Browse files
Show More
@@ -100,6 +100,8 b' def _persist_nodemap(tr, revlog):'
100 with revlog.opener(datafile, b'r+') as fd:
100 with revlog.opener(datafile, b'r+') as fd:
101 fd.seek(target_docket.data_length)
101 fd.seek(target_docket.data_length)
102 fd.write(data)
102 fd.write(data)
103 fd.seek(0)
104 new_data = fd.read(target_docket.data_length + len(data))
103 target_docket.data_length += len(data)
105 target_docket.data_length += len(data)
104 target_docket.data_unused += data_changed_count
106 target_docket.data_unused += data_changed_count
105
107
@@ -113,6 +115,7 b' def _persist_nodemap(tr, revlog):'
113 data = persistent_data(revlog.index)
115 data = persistent_data(revlog.index)
114 # EXP-TODO: if this is a cache, this should use a cache vfs, not a
116 # EXP-TODO: if this is a cache, this should use a cache vfs, not a
115 # store vfs
117 # store vfs
118 new_data = data
116 with revlog.opener(datafile, b'w') as fd:
119 with revlog.opener(datafile, b'w') as fd:
117 fd.write(data)
120 fd.write(data)
118 target_docket.data_length = len(data)
121 target_docket.data_length = len(data)
@@ -122,6 +125,9 b' def _persist_nodemap(tr, revlog):'
122 with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp:
125 with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp:
123 fp.write(target_docket.serialize())
126 fp.write(target_docket.serialize())
124 revlog._nodemap_docket = target_docket
127 revlog._nodemap_docket = target_docket
128 if util.safehasattr(revlog.index, "update_nodemap_data"):
129 revlog.index.update_nodemap_data(target_docket, new_data)
130
125 # EXP-TODO: if the transaction abort, we should remove the new data and
131 # EXP-TODO: if the transaction abort, we should remove the new data and
126 # reinstall the old one.
132 # reinstall the old one.
127
133
General Comments 0
You need to be logged in to leave comments. Login now