python / cherry-picker

🐍🍒⛏ Utility script for backporting/cherry-picking CPython changes from master into one of the maintenance branches.
Apache License 2.0
46 stars 38 forks source link

Fix --dry-run option incorrect behaviour #75

Closed uddmorningsun closed 1 year ago

uddmorningsun commented 1 year ago
# No setting upstream, so output command sequence should print origin
root@2ec8214d91c9:/tmp/cpython# git remote get-url upstream
error: No such remote 'upstream'
root@2ec8214d91c9:/tmp/cpython# cherry_picker --dry-run ab5b56ba6d 3.7
... ...
Dry run requested, listing expected command sequence
  dry-run: git remote get-url upstream
  dry-run: git fetch upstream --no-tags
Now backporting 'ab5b56ba6d' into '3.7'
  dry-run: git remote get-url upstream
  dry-run: git checkout -b backport-ab5b56b-3.7 upstream/3.7
  dry-run: git cherry-pick -x ab5b56ba6d

  dry-run: git show -s --format=%B ab5b56ba6d
Traceback (most recent call last):
... ...

  File "/usr/local/lib/python3.10/dist-packages/cherry_picker/cherry_picker.py", line 645, in cherry_pick_cli
    cherry_picker.backport()
  File "/usr/local/lib/python3.10/dist-packages/cherry_picker/cherry_picker.py", line 387, in backport
    commit_message = self.amend_commit_message(cherry_pick_branch)
  File "/usr/local/lib/python3.10/dist-packages/cherry_picker/cherry_picker.py", line 269, in amend_commit_message
    updated_commit_message = f"""{commit_prefix}{self.get_commit_message(self.commit_sha1)}
  File "/usr/local/lib/python3.10/dist-packages/cherry_picker/cherry_picker.py", line 211, in get_commit_message
    message = self.run_cmd(cmd).strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Signed-off-by: Chenyang Yan memory.yancy@gmail.com

cpython-cla-bot[bot] commented 1 year ago

All commit authors signed the Contributor License Agreement.
CLA signed