go to a specific commit number not id on github

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

go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 5:33 am

how is it possible to jump to commit number 10000 or 99 or 1111 or even 1 on github?

bernd
wmayer
Site Admin
Posts: 14992
Joined: Thu Feb 19, 2009 10:32 am

Re: go to a specific commit number not id on github

Postby wmayer » Mon Sep 24, 2018 9:09 am

In contrast to subversion which uses a consecutive number for its revisions git uses hash values. Since a hash value is not very useful for a user to decide if a certain version is older than another we apply a trick to achieve a consecutive number like in subversion by counting the number of commits:
git rev-list HEAD --count

Now to get the hash value of e.g. the 1111th commit you first must apply the above command to get the number of commits (e.g. 14795) and subtract 1111 from it (13684). With git log --skip=13684 you get the corresponding hash value git commit 73ee872301b1a51c
User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 10:46 am

Thats cool werner :D

BTW: FYI because I don't mind ... github says it is commit 1088 https://github.com/FreeCAD/FreeCAD/tree/73ee872
User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 10:53 am

User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 10:58 am

User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 11:01 am

But 14795-14793 = 2 not 1 github needs some coaching in simple math :mrgreen:
wmayer
Site Admin
Posts: 14992
Joined: Thu Feb 19, 2009 10:32 am

Re: go to a specific commit number not id on github

Postby wmayer » Mon Sep 24, 2018 1:05 pm

bernd wrote:
Mon Sep 24, 2018 10:46 am
Thats cool werner :D

BTW: FYI because I don't mind ... github says it is commit 1088 https://github.com/FreeCAD/FreeCAD/tree/73ee872
This is because at some point something got messed up in the history or so and thus we start from a certain reference commit:
see https://github.com/FreeCAD/FreeCAD/blob ... ev.py#L175

But nevertheless this is already a good start point for further investigations.
User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 1:23 pm

User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 1:30 pm

or https://github.com/FreeCAD/FreeCAD/comm ... 396761+239 click on the commit and click on brows files. Github will show 14555 :)

Code: Select all

https://github.com/FreeCAD/FreeCAD/commits/master?after=8668296f9c7287827888d5f16acbfcaf1b396761+239
239 = 14795 - 14555 - 1
User avatar
bernd
Posts: 8475
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: go to a specific commit number not id on github

Postby bernd » Mon Sep 24, 2018 1:42 pm

or

240 = 14795 - 14555

Code: Select all

git log --skip=240 --oneline -1

Code: Select all

$ git log --skip=240 --oneline -1
7d8e53aaa add Const to ancestorsOfType
$