Recommendations for Version Control

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
freelibre
Posts: 1
Joined: Sun Aug 11, 2019 6:06 am

Re: Recommendations for Version Control

Post by freelibre »

FreeCAD is great but it miss Version Control integration, I also agree it's an important feature.

Onshape has a great versions & branching management features, a demo is available there:
https://www.youtube.com/watch?v=ggL9IQSo4VI

It would be great for Open Hardware Project members, not allways able to use git from a command line, to have such features directly in FreeCAD to interact with a git repo, its branches,versions and to be able to merge them. May be by using existing git GUI interfaces.I have added a such comment in this exisiting Mantis Feature request: https://www.freecadweb.org/tracker/view.php?id=1558 . Hope this will help a bit the FreeCAD project team to priorize this feature.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Recommendations for Version Control

Post by chrisb »

A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
foadsf
Posts: 102
Joined: Fri Mar 06, 2015 10:02 pm
Contact:

Re: Recommendations for Version Control

Post by foadsf »

TIL learned about FreeCAD .FCStd files being zipped XMLs, and following my interest in this topic (CAD version control), I thought I could share my thoughts here as well. I think this workflow could work:
  1. start a git repository right inside the zipped folder
  2. create a .gitignore file, or better to say a git white list, which makes sure only the two XML files GuiDocument.xml and Document.xml and ignore the rest
  3. upon every save it automatically commits
  4. the commit message could be extracted by parsing the git diff and listing all the changes made, plus other comments user could add
  5. if one retrieves to an older commit then all the rest of the files could be deleted and recomputed.
using any code version control to manage binary zipped files is IMHO a bad idea and brings no benefits as far as I can see. With a proper GUI added to FC this could actually be really revolutionary for the FreeCAD ecosystem.
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Recommendations for Version Control

Post by reox »

foadsf wrote: Sat Oct 12, 2019 11:10 am start a git repository right inside the zipped folder
create a .gitignore file, or better to say a git white list, which makes sure only the two XML files GuiDocument.xml and Document.xml and ignore the rest
upon every save it automatically commits
the commit message could be extracted by parsing the git diff and listing all the changes made, plus other comments user could add
if one retrieves to an older commit then all the rest of the files could be deleted and recomputed.
What do you mean by inside the zipped folder?
And why do not add the brp files? Without them you can not reconstruct the part. If you leave them out, you can also not push the git repo to some other location and open the files there.
foadsf
Posts: 102
Joined: Fri Mar 06, 2015 10:02 pm
Contact:

Re: Recommendations for Version Control

Post by foadsf »

reox wrote: Mon Oct 14, 2019 7:36 am What do you mean by inside the zipped folder?
well, the way Lei Zheng (aka RealThunder) is approaching the problem is to save everything inside a folder instead of a zipped file (reference). I'm not sure if exposing the internal guts of a .FCStd file to the users is such a good idea. It should be possible to treat the zip file as a folder in some way or another I think. And then do all git stuff right there without the need to unarchive.

reox wrote: Mon Oct 14, 2019 7:36 am And why do not add the brp files? Without them you can not reconstruct the part. If you leave them out, you can also not push the git repo to some other location and open the files there.
It seems like you can. See this post for example. There I have reconstructed everything using just Document.xml.
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Recommendations for Version Control

Post by reox »

That does not work for me:

Code: Select all

Traceback (most recent call last):
  File "<string>", line 66, in <module>
  File "<string>", line 51, in createDocument
  File "/usr/lib/python3.7/zipfile.py", line 1713, in write
    zinfo = ZipInfo.from_file(filename, arcname)
  File "/usr/lib/python3.7/zipfile.py", line 506, in from_file
    st = os.stat(filename)
<class 'FileNotFoundError'>: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/home/reox/CAD/tmp/PartShape.brp'
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/home/reox/CAD/tmp/PartShape.brp'
if the brp files are not there, it will not create the file.
foadsf
Posts: 102
Joined: Fri Mar 06, 2015 10:02 pm
Contact:

Re: Recommendations for Version Control

Post by foadsf »

reox wrote: Mon Oct 14, 2019 9:04 am That does not work for me:
Would you be kind to explain this issue over there, including your environment? It works for me on Windows and mac ¯\_(ツ)_/¯
Post Reply