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!
earthcare
Posts: 26
Joined: Tue May 31, 2016 7:46 am
Location: Australia

Recommendations for Version Control

Post by earthcare »

Hi all,

I'm chief designer on a development project that has a number of separate components, for each of which there are of course multiple iterations of design, and within a drawing, we track changes in the traditional way. However, what's becoming increasingly difficult is tracking design iterations of multiple design forks we're experimenting with, such as going back to revision N and developing a new branch based on that.

In my days in software development, version control systems such as CVS were in use, but I can't find anything that does the same job with CAD files. We don't really need to merge files (as with source code), but to track the status of the design, catalogue the files, etc.

Can anyone recommend (preferably GUI) software for this?

Thanks
Edwin
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Recommendations for Version Control

Post by chrisb »

You can use CVS or better subversion and check in binary files of any CAD type.

Since FreeCAD is in fact a zip archive containing xml files you can do much better with archiving those.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Recommendations for Version Control

Post by Kunda1 »

I think yorik developed a git addon for FC in his webtools addon:
https://github.com/yorikvanhavre/WebTools
I haven't used it.
Here are the instructions: https://www.freecadweb.org/wiki/Arch_Git
But it may just be for Arch WB ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Recommendations for Version Control

Post by yorik »

Kunda1 wrote: Mon Jul 17, 2017 11:52 amBut it may just be for Arch WB ?
This tool has been removed from Arch and is now part of the Webtools addon. I forgot to change the doc page apparently :)

Yes it's usable with any FreeCAD document. But it's still pretty simple. Basically, if the currently opened FreeCAD document is inside a git repo, this tool allows you to commit, push and pull...

In theory yes, FreeCAD files are zip files, and 80 or 90% of what they contain is text files. So it is possible to unzip, and commit each individual file inside with a VCS system, taking advantage of text diffs. But in practice I found that the gain is small (commits take less space) and the hassle is big (there can be many many files inside the fcstd file) and there is no really big advantage (the text diffs don't really help to figure out what changed in the file). So I more or less abandoned the idea, and nowadays I just commit the fcstd file as is...

I also wrote a small tool called fcinfo see the Arch Git page that Kunda2 mentioned) that prints a "summary" of an fcstd file, and is intended to help figuring out what changed in an fcstd file. That tool can also be used with git.
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Recommendations for Version Control

Post by reox »

As I use git for almost 99.9% of all projects now, I would use git for FreeCAD projects as well.
I installed the Webtools WB, but all it does is to allow you to commit/push/pull in freecad directly?

What I would really like to have would be the following workflow:
* create a new freecad project
* tick something and say "use version control"
* a git repo is created
* If you create now any files with freecad, they are commited into the repo
* you could configure if you like to commit on every save / created feature / only on exit ...

Now you could give a treeview of your development, e.g. with tags you could identify versions of your product and you are able to go back to an old version and work on that again.

In theory you could also allow merging of files. as far as I understand the fileformat, it should be possible...

Is there something like this already? If I have time, I might want to start developing such an addon.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Recommendations for Version Control

Post by Kunda1 »

https://github.com/reox/FreeCAD_gitproj ... -354469296
How can we make FreeCAD.Console.PrintMessage() play nice with unicode?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Recommendations for Version Control

Post by looo »

https://github.com/FreeCAD/FreeCAD/blob ... p#L443L457

Maybe using:
PyUnicode_AsUTF8String instead of PyUnicode_AsEncodedObject.

the currently used function "PyUnicode_AsEncodedObject" is not listed here https://docs.python.org/2.7/c-api/unicode.html

ps.: I do not build with py2 anymore. Maybe someone else can give it a try.
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Recommendations for Version Control

Post by reox »

I think the problem is, if you mix strings and unicode strings:

Code: Select all

"bla {}".format(a_funtion_that_returns_a_unicode_string())
produces an error, while

Code: Select all

u"bla {}".format(a_funtion_that_returns_a_unicode_string())
will work fine.

I would also use python3, but as I'm using the daily builds, I'm still bound to py2 :(
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Recommendations for Version Control

Post by Kunda1 »

Another question:
Does anyone know how we can change the icons in the tabbar?
Image
The reason is to show that the current file in the FC GUI is currently under version control ( https://github.com/reox/FreeCAD_gitproject/issues/7 )
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Recommendations for Version Control

Post by Kunda1 »

Relevant threads:

The need for git as a versioning tool for .fcstd files (from the Asssembly3 thread):
ceremcem wrote: Mon Jun 24, 2019 12:50 pm You should always use some kind of project versioning tool, such as git (although it doesn't play well with .fcstd files) or a dedicated tool. Developing a model with Asm3 is much like developing a software with thousands of dependencies. Same problem applies there, no one can help you if you don't use a versioning tool.
Different topic:
Overlaying icon attachment status:
https://forum.freecadweb.org/viewtopic. ... c1#p315183
https://forum.freecadweb.org/viewtopic. ... 19#p314719
https://github.com/FreeCAD/FreeCAD/pull/2272
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply