Skip to content

git.iter_commits() cannot specify both a branch and commits between two revisions("reva....revb") #1111

Description

@socratesgorilla

What I mean is something identical to the function of, say, git log upstream/master b59e00e...f79a12b

This 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.

Activity

  1. Byron commented on Jan 23, 2021

    @Byron
    Member

    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.

  2. socratesgorilla commented on Jan 26, 2021

    @socratesgorilla
    Author

    It doesn't let you specify a branch, as far as I can tell.

  3. Byron commented on Jan 27, 2021

    @Byron
    Member

    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.

  4. reopened this on Feb 26, 2021
  5. locked and limited conversation to collaborators on Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions