How to find a Revisionnr. of a Commit

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
bernd
Posts: 8414
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

How to find a Revisionnr. of a Commit

Postby bernd » Mon Jan 06, 2014 10:41 pm

How do I get the revision number of a commit? As an example may the number of the following commit

https://github.com/FreeCAD/FreeCAD_sf_m ... 520e05e9e2

It should be around 2600
wmayer
Site Admin
Posts: 14869
Joined: Thu Feb 19, 2009 10:32 am

Re: How to find a Revisionnr. of a Commit

Postby wmayer » Tue Jan 07, 2014 10:34 am

Unlike Subversion git does not work with revision numbers but with sha1 values. To extract some kind of revision number which humans understand better we count the number of newlines of all listed sha1 values. So, to get this information you have to:

Code: Select all

git rev-list <sha1> | wc -l
which in your case is:

Code: Select all

git rev-list f654c632ba9366ba2527284424469d520e05e9e2 | wc -l
which gives you 2655
User avatar
bernd
Posts: 8414
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to find a Revisionnr. of a Commit

Postby bernd » Tue Jan 07, 2014 12:10 pm

wmayer wrote:...To extract some kind of revision number which humans understand better we count the number of newlines of all listed sha1 values. So, to get this information you have to:

Code: Select all

git rev-list <sha1> | wc -l
...
Ahh, I knew about the sh1 values. Counting the newlines ... That is why I couldn'd find anything in my git book. Thanks Werner :)
User avatar
bernd
Posts: 8414
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to find a Revisionnr. of a Commit

Postby bernd » Mon Oct 19, 2015 10:59 am

see viewtopic.php?f=18&t=12883&p=103207#p103203 if one would like to have a commitID from a revision nr.
User avatar
DeepSOIC
Posts: 7015
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: How to find a Revisionnr. of a Commit

Postby DeepSOIC » Mon Oct 19, 2015 11:10 am

Hmm. Some old thread. Anyway, here's how I usually get a revision number from commit:
github revision number.png
github revision number.png (87.13 KiB) Viewed 1312 times
User avatar
bernd
Posts: 8414
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to find a Revisionnr. of a Commit

Postby bernd » Mon Oct 19, 2015 11:39 am

Thanks przemo, haven't missed that opening the blob on github will show the revision id :D

Code: Select all

https://github.com/FreeCAD/FreeCAD/tree/Put_in_the_commitID
https://github.com/FreeCAD/FreeCAD/tree/bb05d1 shows revisionID 5560
User avatar
PrzemoF
Posts: 2654
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: How to find a Revisionnr. of a Commit

Postby PrzemoF » Mon Oct 19, 2015 1:36 pm

It wasn't me, but I can take the credit ;)
Mine solution below:

Code: Select all

[przemo@localhost freecad]$ git rev-list --count f654c632ba9366ba2527284424469d520e05e9e2 
2655