Skip to content

Constant failures: "Command '['git', 'log', '--format=%H', '3.12..']' returned non-zero exit status 128" #124

Closed

Description

@sobolevn

This is happening for me everytime I do manual backports:

(.venv) ~/Desktop/cpython2  main ✔                                                        
» cherry_picker a1c4923d65a3e4cea917745e7f6bc2e377cde5c5 3.12
🐍 🍒 ⛏
Now backporting 'a1c4923d65a3e4cea917745e7f6bc2e377cde5c5' into '3.12'
Error cherry-pick a1c4923d65a3e4cea917745e7f6bc2e377cde5c5.
Auto-merging Lib/test/test_cmd_line.py
CONFLICT (content): Merge conflict in Lib/test/test_cmd_line.py
error: could not apply a1c4923d65a... gh-116858: Add `@cpython_only` to several tests in `test_cmd_line` (#116859)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
Recorded preimage for 'Lib/test/test_cmd_line.py'


Failed to cherry-pick a1c4923d65a3e4cea917745e7f6bc2e377cde5c5 into 3.12 ☹
... Stopping here.

To continue and resolve the conflict:
    $ cherry_picker --status  # to find out which files need attention
    # Fix the conflict
    $ cherry_picker --status  # should now say 'all conflict fixed'
    $ cherry_picker --continue

To abort the cherry-pick and cleanup:
    $ cherry_picker --abort

                                                                                           
(.venv) ~/Desktop/cpython2  backport-a1c4923-3.12 ✗                                § 255 ⚠️
» git add --all
                                                                                           
(.venv) ~/Desktop/cpython2  backport-a1c4923-3.12 ✗                                     ✚ 
» cherry_picker --continue --pr-remote=fork                  
🐍 🍒 ⛏
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/.venv/bin/cherry_picker", line 8, in <module>
    sys.exit(cherry_pick_cli())
             ^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/cherry_picker/cherry_picker.py", line 802, in cherry_pick_cli
    cherry_picker.continue_cherry_pick()
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/cherry_picker/cherry_picker.py", line 591, in continue_cherry_pick
    commits = get_commits_from_backport_branch(base)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/.venv/lib/python3.11/site-packages/cherry_picker/cherry_picker.py", line 902, in get_commits_from_backport_branch
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/.pyenv/versions/3.11.5/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/.pyenv/versions/3.11.5/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'log', '--format=%H', '3.12..']' returned non-zero exit status 128.

fork is my own fork: https://github.com/sobolevn/cpython/ which I use to send PRs to the main repo.

Things I've tried:

  • Cleaning .git/config file
  • Reinstalling cherry-picker
  • Using different Python version

I mostly use 3.11.5 as my venv tooling.

Looking through existing issues - no matches :(

Activity

  1. aloisklink commented on Jun 2, 2024

    @aloisklink
    Contributor

    It sounds similar to #99 (comment)

    Does git log --format=%H 3.12.. work?

    It might be that the 3.12 branch doesn't exist in your local repo. You might have to run git switch 3.12 to create it first.

  2. skirpichev commented on Aug 3, 2024

    @skirpichev
    Member

    Yeah, just happened with me (again). I think it's a bug: tool should automate this.

    And beware #99 :D

  3. ncoghlan commented on Oct 7, 2024

    @ncoghlan
    Contributor

    I just ran into the same issue, and tested @aloisklink's theory regarding the origin of the problem. Creating the local branch makes the failure go away.

    So yes, it would be nice if cherry_picker did a git switch <target branch> before creating the backport branch.

  4. adqm commented on Aug 14, 2025

    @adqm

    First time using cherry_picker today and I ran into this issue. Took me a longer than I would like to admit to realize that it was because I didn't have a 3.13 branch locally (it was only afterward that I found this issue).

    So just adding another note that it would be great to have this fixed :)

  5. hugovk commented on Aug 21, 2025

    @hugovk
    Member

    The fix for this has been released in Cherry Picker 2.6.0: https://github.com/python/cherry-picker/releases/tag/cherry-picker-v2.6.0 🍒🚀

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions