dirstate: make `restorebackup` more robust when it is a noop
If there are no data_file, we might not be able to determine its filename.
Which can be safely ignored.
(all this code is on the way out anyway)
--- a/mercurial/dirstate.py Thu Feb 16 00:33:15 2023 +0100
+++ b/mercurial/dirstate.py Thu Feb 16 05:03:28 2023 +0100
@@ -1671,7 +1671,7 @@
# there was no file backup, delete existing files
filename = self._actualfilename(tr)
data_file = None
- if self._use_dirstate_v2:
+ if self._use_dirstate_v2 and self._map.docket.uuid is not None:
data_file = self._map.docket.data_filename()
if o.exists(filename):
o.unlink(filename)