equal
deleted
inserted
replaced
72 use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap") |
72 use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap") |
73 |
73 |
74 test_race_hook_1() |
74 test_race_hook_1() |
75 try: |
75 try: |
76 with revlog.opener(filename) as fd: |
76 with revlog.opener(filename) as fd: |
77 if use_mmap: |
77 if use_mmap and revlog.opener.is_mmap_safe(filename): |
78 try: |
78 try: |
79 data = util.buffer(util.mmapread(fd, data_length)) |
79 data = util.buffer(util.mmapread(fd, data_length)) |
80 except ValueError: |
80 except ValueError: |
81 # raised when the read file is too small |
81 # raised when the read file is too small |
82 data = b'' |
82 data = b'' |
203 tr.add(datafile, target_docket.data_length) |
203 tr.add(datafile, target_docket.data_length) |
204 with revlog.opener(datafile, b'r+') as fd: |
204 with revlog.opener(datafile, b'r+') as fd: |
205 fd.seek(target_docket.data_length) |
205 fd.seek(target_docket.data_length) |
206 fd.write(data) |
206 fd.write(data) |
207 if feed_data: |
207 if feed_data: |
208 if use_mmap: |
208 if use_mmap and revlog.opener.is_mmap_safe(datafile): |
209 fd.flush() |
209 fd.flush() |
210 new_data = util.buffer(util.mmapread(fd, new_length)) |
210 new_data = util.buffer(util.mmapread(fd, new_length)) |
211 else: |
211 else: |
212 fd.seek(0) |
212 fd.seek(0) |
213 new_data = fd.read(new_length) |
213 new_data = fd.read(new_length) |
236 # simply empty them. |
236 # simply empty them. |
237 tr.addabort(callback_id, abortck) |
237 tr.addabort(callback_id, abortck) |
238 with revlog.opener(datafile, b'w+') as fd: |
238 with revlog.opener(datafile, b'w+') as fd: |
239 fd.write(data) |
239 fd.write(data) |
240 if feed_data: |
240 if feed_data: |
241 if use_mmap: |
241 if use_mmap and revlog.opener.is_mmap_safe(datafile): |
242 fd.flush() |
242 fd.flush() |
243 new_data = util.buffer(util.mmapread(fd, len(data))) |
243 new_data = util.buffer(util.mmapread(fd, len(data))) |
244 else: |
244 else: |
245 new_data = data |
245 new_data = data |
246 target_docket.data_length = len(data) |
246 target_docket.data_length = len(data) |