Version Number Explained?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
wandererfan
Posts: 3845
Joined: Tue Nov 06, 2012 5:42 pm

Version Number Explained?

Postby wandererfan » Tue Mar 28, 2017 1:25 pm

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
Posts: 2181
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: Version Number Explained?

Postby r-frank » Tue Mar 28, 2017 1:30 pm

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
Posts: 5800
Joined: Wed Oct 22, 2014 5:02 pm

Re: Version Number Explained?

Postby sgrogan » Tue Mar 28, 2017 1:56 pm

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
User avatar
wandererfan
Posts: 3845
Joined: Tue Nov 06, 2012 5:42 pm

Re: Version Number Explained?

Postby wandererfan » Tue Mar 28, 2017 11:41 pm

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
Posts: 5800
Joined: Wed Oct 22, 2014 5:02 pm

Re: Version Number Explained?

Postby sgrogan » Wed Mar 29, 2017 12:14 am

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.
User avatar
PrzemoF
Posts: 2895
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Version Number Explained?

Postby PrzemoF » Wed Mar 29, 2017 9:18 am

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
Posts: 3845
Joined: Tue Nov 06, 2012 5:42 pm

Re: Version Number Explained?

Postby wandererfan » Thu Mar 30, 2017 12:31 am

PrzemoF wrote:

Code: Select all

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