Create backup file when writing new xml file?

Linus Torvalds torvalds at
Sun Feb 16 14:36:16 UTC 2014

On Sun, Feb 16, 2014 at 2:23 PM, Dirk Hohndel <dirk at> wrote:
> On Sun, 2014-02-16 at 14:21 -0800, Dirk Hohndel wrote:
>> I will take the patch as is and ask the Windows expert (Lubomir) and the
>> Qt export (Thiago) to see if there is something we should do
>> differently.
> Should have looked more closely... this is lacking a concise commit
> message and SOB...

Ok, so something like the appended.


Rename old 'xml' file as 'bak' file when saving

If you use the standard naming convention and end your subsurface
filename in ".xml", we will now save away any previous xml file as a
"bak" file before writing a new one.

This can be useful for:

 - recovering from mistakes that deleted old dives

 - seeing what changed (ie you can do things like "diff -u xyz.bak
xyz.xml") after doing some operation and saving the result.

However, this does only a single level of backups - if you save twice,
you will obviously have lost the original. I'd strongly encourage some
external backup system in addition to this very simplistic backup.

Signed-off-by: Linus Torvalds <torvalds at>

More information about the subsurface mailing list