grd / FreePDM

A PDM for FreeCAD
MIT License
37 stars 5 forks source link

UUID tip #37

Closed luzpaz closed 1 year ago

luzpaz commented 2 years ago

Question:

Recently I discovered that when I save files I don't have a version history for FreeCAD files on my nextcloud server. I swapped to a self hosted nextcloud server to have proper version control for files. I mount the webdav in my home directory or gnome online accounts. Both are virtually the same.

I'm guessing that it deletes the old file and creates a new file every time.

Every other software works. When I modify and save a file I can revert to previous version if something goes wrong.

Wanted to check if anybody has some experience with this or maybe a work around.

Answer:

When saving a document then FreeCAD first creates a file with a UUID in the filename and afterwards -- depending on user settings -- it renames or deletes the old file and then removes the UUID from the newly created file. This is to avoid to lose data in case the write process failed.

However, the default behaviour can be switched off. Open the parameter editor in the Tools menu and navigate to BaseApp > Preferences > Document. There create a boolean key BackupPolicy and set it to false.

Ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=47727

grd commented 2 years ago

One of those hidden gems...

luzpaz commented 2 years ago

Maybe we should make a wiki page for this type of tip (besides Fine tuning

grd commented 2 years ago

I agree but then you end up with a workaround of a workaround. This is insane. @ FC they didn't bother to document it so we are required to document it...

Jee-Bee commented 2 years ago

In my UML branch (https://github.com/Jee-Bee/FreePDM/tree/uml-model. You can also view the resulting images in your browser) I already was thinking about a solution for that see the ACT_StoreFile diagram. My basic idea is store every time it is checked in twice. Once as the default [Filename].FCStd and once as [Filename].FCStd.# / [Filename].#.FCStd, where the # is a iterator. In this way you can always go back to a requested previous version. And If an old version is required for some reason It shouldn't be difficult to rename it automatically.

Edit: I am thinking about to give every version an own image so that it is more easy to compare iterations.

grd commented 2 years ago

@luzpaz, It still leaves one question: How do you know weather a file is open in FC or closed?

@Jee-Bee, yes it can work, but only when you add the dot at the end, like [Filename].FCStd.# because you need to distinguish those files from the rest. I don't really like it but that seems a way to solve this issue. The other way is to use a VCS.

grd commented 2 years ago

Edit: I am thinking about to give every version an own image so that it is more easy to compare iterations.

In that case I better work on the assembly structure ;-)

grd commented 1 year ago

The new filesystem deals with these issues.