Skip to content

Sometimes, an imprecise branch reference can't be resolved during continuationΒ #155

Closed

Description

@webknjaz

I've hit a conflict, fixed it re-ran cherry-picker with --continue and got a traceback + an invalid state in the config:

$ uvx --from cherry-picker cherry_picker --continue
🐍 πŸ’ ⛏
Traceback (most recent call last):
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/bin/cherry_picker", line 10, in <module>
    sys.exit(cherry_pick_cli())
             ~~~~~~~~~~~~~~~^^
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/cherry_picker/cherry_picker.py", line 855, in cherry_pick_cli
    cherry_picker.continue_cherry_pick()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/cherry_picker/cherry_picker.py", line 639, in continue_cherry_pick
    commits = get_commits_from_backport_branch(base)
  File "~/.cache/uv/archive-v0/EI4uSp-Fsr1kEx0L58PRM/lib/python3.13/site-packages/cherry_picker/cherry_picker.py", line 965, in get_commits_from_backport_branch
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "~/.pyenv/versions/3.13.0/lib/python3.13/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "~/.pyenv/versions/3.13.0/lib/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'log', '--format=%H', 'stable-2.14..']' returned non-zero exit status 128.

$ uvx --from cherry-picker cherry_picker --continue
🐍 πŸ’ ⛏
Run state cherry-picker.state=CONTINUATION_STARTED 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`

Running that Git command revealed the inability of Git to resolve the stable-2.14 reference, while it is perfectly fine resolving the remote pointer origin/stable-2.14:

$ git log --format='%H' stable-2.14..
fatal: ambiguous argument 'stable-2.14..': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

$ git log --format='%H' stable-2.14.. --
fatal: bad revision 'stable-2.14..'

$ git log --format='%H' origin/stable-2.14..

This seems to be easily fixable by passing a better identifier to get_commits_from_backport_branch().

Activity

  1. added a commit that references this issue on Feb 10, 2025
    0837b57
  2. changed the title [-]Sometimes, old broken repos can't look up an imprecise branch reference, breaking continuation[/-] [+]Sometimes, an imprecise branch reference can't be resolved during continuation[/+] on Feb 10, 2025
  3. 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