Show More
@@ -116,6 +116,9 b' class _dirstatemapcommon:' | |||||
116 | ) |
|
116 | ) | |
117 | data_filename = new_docket.data_filename() |
|
117 | data_filename = new_docket.data_filename() | |
118 | self._opener.write(data_filename, packed) |
|
118 | self._opener.write(data_filename, packed) | |
|
119 | # tell the transaction that we are adding a new file | |||
|
120 | if tr is not None: | |||
|
121 | tr.addbackup(data_filename, location=b'plain') | |||
119 | # Write the new docket after the new data file has been |
|
122 | # Write the new docket after the new data file has been | |
120 | # written. Because `st` was opened with `atomictemp=True`, |
|
123 | # written. Because `st` was opened with `atomictemp=True`, | |
121 | # the actual `.hg/dirstate` file is only affected on close. |
|
124 | # the actual `.hg/dirstate` file is only affected on close. | |
@@ -125,6 +128,8 b' class _dirstatemapcommon:' | |||||
125 | # the new data file was written. |
|
128 | # the new data file was written. | |
126 | if old_docket.uuid: |
|
129 | if old_docket.uuid: | |
127 | data_filename = old_docket.data_filename() |
|
130 | data_filename = old_docket.data_filename() | |
|
131 | if tr is not None: | |||
|
132 | tr.addbackup(data_filename, location=b'plain') | |||
128 | unlink = lambda _tr=None: self._opener.unlink(data_filename) |
|
133 | unlink = lambda _tr=None: self._opener.unlink(data_filename) | |
129 | if tr: |
|
134 | if tr: | |
130 | category = b"dirstate-v2-clean-" + old_docket.uuid |
|
135 | category = b"dirstate-v2-clean-" + old_docket.uuid | |
@@ -612,6 +617,14 b' if rustmod is not None:' | |||||
612 | if append: |
|
617 | if append: | |
613 | docket = self.docket |
|
618 | docket = self.docket | |
614 | data_filename = docket.data_filename() |
|
619 | data_filename = docket.data_filename() | |
|
620 | # We mark it for backup to make sure a future `hg rollback` (or | |||
|
621 | # `hg recover`?) call find the data it needs to restore a | |||
|
622 | # working repository. | |||
|
623 | # | |||
|
624 | # The backup can use a hardlink because the format is resistant | |||
|
625 | # to trailing "dead" data. | |||
|
626 | if tr is not None: | |||
|
627 | tr.addbackup(data_filename, location=b'plain') | |||
615 | with self._opener(data_filename, b'r+b') as fp: |
|
628 | with self._opener(data_filename, b'r+b') as fp: | |
616 | fp.seek(docket.data_size) |
|
629 | fp.seek(docket.data_size) | |
617 | assert fp.tell() == docket.data_size |
|
630 | assert fp.tell() == docket.data_size |
General Comments 0
You need to be logged in to leave comments.
Login now