Skip to content

passing git args to filter output failed? #1097

Description

@butterl

Is it possiable to passing args like refs/tags/TAG01 ..HEAD --no-merges to filter the out put commit ?

repo = Repo(path)
for commit in repo.iter_commits(rev='refs/tags/TAG1.0..HEAD --no-merges'))
    print(commit)

the error show like this

  File "/home/ubuntu/.local/lib/python3.8/site-packages/git/objects/commit.py", line 277, in _iter_from_process_or_stream
    finalize_process(proc_or_stream)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/git/util.py", line 329, in finalize_process
    proc.wait(**kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/git/cmd.py", line 408, in wait
    raise GitCommandError(self.args, status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git rev-list refs/tags/TAG01..HEAD --no-merges --
  stderr: 'fatal: bad revision 'refs/tags/TAG01..HEAD --no-merges'

the cmd git rev-list refs/tags/TAG01..HEAD --no-merges -- seems work fine in cmdline run

Activity

  1. Byron commented on Dec 29, 2020

    @Byron
    Member

    I think what you are trying to do might work with the help of the docs on 'how to use git directly' along with the API docs on iter_commits().

    With that, you should be able to figure out which options to pass to git rev-list as kwargs of iter_commits(…) to get the desired result.

    Even though I close this issue, feel free to post follow ups in the comments.

  2. reopened this on Feb 26, 2021
  3. 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

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions