How to find a Revisionnr. of a Commit
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
How to find a Revisionnr. of a Commit
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
https://github.com/FreeCAD/FreeCAD_sf_m ... 520e05e9e2
It should be around 2600
Re: How to find a Revisionnr. of a Commit
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:
which in your case is:
which gives you 2655
Code: Select all
git rev-list <sha1> | wc -l
Code: Select all
git rev-list f654c632ba9366ba2527284424469d520e05e9e2 | wc -l
Re: How to find a Revisionnr. of a Commit
Ahh, I knew about the sh1 values. Counting the newlines ... That is why I couldn'd find anything in my git book. Thanks Wernerwmayer 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
Re: How to find a Revisionnr. of a Commit
see viewtopic.php?f=18&t=12883&p=103207#p103203 if one would like to have a commitID from a revision nr.
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: How to find a Revisionnr. of a Commit
Hmm. Some old thread. Anyway, here's how I usually get a revision number from commit:
Re: How to find a Revisionnr. of a Commit
Thanks przemo, haven't missed that opening the blob on github will show the revision id
https://github.com/FreeCAD/FreeCAD/tree/bb05d1 shows revisionID 5560
Code: Select all
https://github.com/FreeCAD/FreeCAD/tree/Put_in_the_commitID
Re: How to find a Revisionnr. of a Commit
It wasn't me, but I can take the credit
Mine solution below:
Mine solution below:
Code: Select all
[przemo@localhost freecad]$ git rev-list --count f654c632ba9366ba2527284424469d520e05e9e2
2655
Re: How to find a Revisionnr. of a Commit
Necro-bumping this thread in case ones could be interested in getting a commit number without having to use git (and mainly having to git-clone FC).
I issued a very simple way to get it at HEAD or at a specific SHA.
For Windows users, cURL & sed can be downloaded from GoW.
Hope that helps.
I issued a very simple way to get it at HEAD or at a specific SHA.
For Windows users, cURL & sed can be downloaded from GoW.
Hope that helps.
Re: How to find a Revisionnr. of a Commit
It's two lines. You know you can just post it in this thread inside code tags...openBrain wrote: ↑Fri Dec 27, 2019 7:06 pm I issued a very simple way to get it at HEAD or at a specific SHA.
Code: Select all
curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1" | sed -n '/^Link:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'
### And that's all !
# I saw many fighting with finding first commit SHA or similar fancy thing.
# Here we just rely on the GH API, asking commits at 1 per page and parsing the last page number in the header of the reply (whose body only holds the last commit !)
# So this is robust and bandwidth efficient. :)
# If one want the commit count of a specific SHA, just use :
curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1&sha=:sha" | sed -n '/^Link:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.