You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git.iter_commits() cannot specify both a branch and commits between two revisions("reva....revb") #1111
Did you try something like len(list(r.iter_commits('HEAD~20..HEAD')))? That worked as expected for me.
Maybe the documentation could be updated to explicitly mention that case if it works for you too - a PR would then be very welcome.
The refspec HEAD~20..HEAD means all commits between the 20th ancestor of the currently checked out one (HEAD~20), and the currently checked out one (HEAD). HEAD may as well be branch, meaning that branch1..branch2 will work similarly.
Now it would be interesting to find out what happens if branch1 is not an ancestor of branch2.
As this capability is documented, too, I don't see a need to keep this open any longer. If there is trouble with this nonetheless, please let me know in the comments.
What I mean is something identical to the function of, say,
git log upstream/master b59e00e...f79a12bThis does not work for iter_commits, as rev only takes one argument. If there is a way to do this natively, it is not documented.