python / python/cherry-picker

Unexpected run state encountered

Open
#65 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
65
Forks
47
Avg merge
5m
Merged PRs (30d)
1

Description

When trying to backport this PR, miss-islington failed and advised running cherry_picker from the CLI. When running

cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.11

It failed with this traceback:

~/projects/cpython/3.11 [3.11|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.11
🐍 🍒 ⛏
Now backporting '067597522a9002f3b8aff7f46033f10acb2381e4' into '3.11'
[backport-0675975-3.11 5beb16b77f] gh-92897: Ensure `venv --copies` respects source build property of the creating interpreter (GH-92899)
 Author: Jeremy Kloth <jeremy.kloth@gmail.com>
 Date: Tue Jul 5 10:08:20 2022 -0500
 5 files changed, 76 insertions(+), 40 deletions(-)

Backport PR URL:
https://github.com/python/cpython/compare/3.11...vsajip:backport-0675975-3.11?expand=1
Traceback (most recent call last):
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/bin/cherry_picker", line 8, in <module>
    sys.exit(cherry_pick_cli())
             ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 645, in cherry_pick_cli
    cherry_picker.backport()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 400, in backport
    self.cleanup_branch(cherry_pick_branch)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 361, in cleanup_branch
    self.checkout_default_branch()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 226, in checkout_default_branch
    self.run_cmd(cmd)
    ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 181, in run_cmd
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 454, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 558, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '('git', 'checkout', 'main')' returned non-zero exit status 128.

Now I was in the 3.11 branch so I'm not sure it should be doing a git checkout main. But anyway, the PR was created (in that it opened the "Create pull request" page in the browser, which I clicked to confirm - the PR is here. But if I now try to do the same thing for 3.10, I get

~/projects/cpython/3.10 [3.10|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.10
🐍 🍒 ⛏
Usage: cherry_picker [OPTIONS] [COMMIT_SHA1] [BRANCHES]...
Try 'cherry_picker -h' for help.

Error: Run state cherry-picker.state=CHECKING_OUT_DEFAULT_BRANCH in Git config is not known.
Perhaps it has been set by a newer version of cherry-picker. Try upgrading.
Valid states are: BACKPORT_PAUSED, UNSET. If this looks suspicious, raise an issue at https://github.com/python/cherry-picker/issues/new.
As the last resort you can reset the runtime state stored in Git config using the following command: `git config --local --remove-section cherry-picker`

I did git config --local --remove-section cherry-picker and tried again, but now I get

~/projects/cpython/3.10 [3.10|✔] $ git config --local --remove-section cherry-picker
~/projects/cpython/3.10 [3.10|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.10
🐍 🍒 ⛏
Traceback (most recent call last):
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/bin/cherry_picker", line 8, in <module>
    sys.exit(cherry_pick_cli())
             ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 645, in cherry_pick_cli
    cherry_picker.backport()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 375, in backport
    self.fetch_upstream()
    ^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 173, in fetch_upstream
    self.run_cmd(cmd)
    ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 181, in run_cmd
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 454, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 558, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '['git', 'fetch', 'upstream', '--no-tags']' returned non-zero exit status 1.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cherry_pick_cli entry point and the backport, cleanup_branch, checkout_default_branch, fetch_upstream, and run_cmd paths named in the traceback. Reproduce the reported 3.11 and 3.10 commands and inspect how the Git config run state is recorded and recovered. Done should include coverage for the unexpected state and the reported checkout or fetch failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.