Version Number Explained?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Version Number Explained?

Post by wandererfan »

In our Version numbers (0.vv.gggg), where does the gggg come from (other than Help>AboutFreeCAD)? Is this number available via a git command? Is it stored in a .h file? Generated at build time? Is there a way to reference commit to gggg or vice versa?

Thanks,
wf
User avatar
r-frank
Veteran
Posts: 2180
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: Version Number Explained?

Post by r-frank »

Hi wandererfan.

Read here.
Maybe also of interest.

Roland
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Version Number Explained?

Post by sgrogan »

wandererfan wrote:In our Version numbers (0.vv.gggg), where does the gggg come from (other than Help>AboutFreeCAD)? Is this number available via a git command? Is it stored in a .h file? Generated at build time? Is there a way to reference commit to gggg or vice versa?
This scipt is run by Cmake https://github.com/FreeCAD/FreeCAD/blob ... ubWCRev.py
It creates ..builddir/src/build/version.h
After compile it is available by python

Code: Select all

import FreeCAD
print(FreeCAD.Version()[:3])
or just

Code: Select all

 print(FreeCAD.Version()[2])
from the FC python console
"fight the good fight"
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Version Number Explained?

Post by wandererfan »

So if I want to know the version as of a past commit, I
- check out the commit
- make a branch from the detached commit
- make a new build directory & build?

This will give me the same vv.gggg?
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Version Number Explained?

Post by sgrogan »

wandererfan wrote:- make a new build directory & build?

This will give me the same vv.gggg?
Only need to cmake, But this is not practical. We need to count from the hash of a commit. Should be be possible with a git command, as you originally asked. Relevant part of the script is here:https://github.com/FreeCAD/FreeCAD/blob ... ev.py#L178
I'll try to understand the "git rev-list --count" part.

Code: Select all

git checkout `git log origin/master --oneline --reverse --format=format:%H |head -n [color=#FF0000]6707[/color] |tail -n 1`
Works if you know the version. "origin" is the default remote, in this case for me it's
you might need to use "upstream" or whatever you called "blessed" to use shoogen's terms.
"fight the good fight"
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Version Number Explained?

Post by PrzemoF »

wandererfan wrote:In our Version numbers (0.vv.gggg), where does the gggg come from (other than Help>AboutFreeCAD)? Is this number available via a git command? Is it stored in a .h file? Generated at build time? Is there a way to reference commit to gggg or vice versa?

Thanks,
wf

Code: Select all

[przemo@localhost freecad]$ git rev-list --count HEAD
10659
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Version Number Explained?

Post by wandererfan »

PrzemoF wrote:

Code: Select all

[przemo@localhost freecad]$ git rev-list --count HEAD
10659
This works perfectly! Thanks.
Post Reply