Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
rev: v0.15.9
hooks:
- id: ruff-check
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.3.1
hooks:
- id: black

Expand All @@ -25,18 +25,18 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.36.0
rev: 0.37.1
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.7.10
rev: v1.7.12
hooks:
- id: actionlint

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
rev: v1.20.0
hooks:
- id: mypy
args:
Expand All @@ -50,17 +50,17 @@ repos:
additional_dependencies: ["types-requests"]

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.14.2
rev: v1.23.1
hooks:
- id: zizmor

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.11.1
rev: v2.21.0
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
rev: v0.25
hooks:
- id: validate-pyproject

Expand All @@ -70,7 +70,7 @@ repos:
- id: tox-ini-fmt

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
args: [--ignore-words-list=commitish]
Expand Down
6 changes: 2 additions & 4 deletions cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@ def amend_commit_message(self, cherry_pick_branch):
return updated_commit_message

def pause_after_committing(self, cherry_pick_branch):
click.echo(
f"""
click.echo(f"""
Finished cherry-pick {self.commit_sha1} into {cherry_pick_branch} \U0001f600
--no-push option used.
... Stopping here.
Expand All @@ -408,8 +407,7 @@ def pause_after_committing(self, cherry_pick_branch):

To abort the cherry-pick and cleanup:
$ cherry_picker --abort
"""
)
""")
self.set_paused_state()

def push_to_remote(self, base_branch, head_branch, commit_message=""):
Expand Down
30 changes: 10 additions & 20 deletions cherry_picker/test_cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,12 @@ def test_find_config_not_git(tmpdir, cd):

def test_load_full_config(tmp_git_repo_dir, git_add, git_commit):
relative_config_path = ".cherry_picker.toml"
tmp_git_repo_dir.join(relative_config_path).write(
"""\
tmp_git_repo_dir.join(relative_config_path).write("""\
team = "python"
repo = "core-workfolow"
check_sha = "5f007046b5d4766f971272a0cc99f8461215c1ec"
default_branch = "devel"
"""
)
""")
git_add(relative_config_path)
git_commit("Add config")
scm_revision = get_sha1_from("HEAD")
Expand All @@ -503,11 +501,9 @@ def test_load_full_config(tmp_git_repo_dir, git_add, git_commit):

def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit):
relative_config_path = ".cherry_picker.toml"
tmp_git_repo_dir.join(relative_config_path).write(
"""\
tmp_git_repo_dir.join(relative_config_path).write("""\
repo = "core-workfolow"
"""
)
""")
git_add(relative_config_path)
git_commit("Add config")
scm_revision = get_sha1_from("HEAD")
Expand All @@ -528,14 +524,12 @@ def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit):

def test_load_config_no_head_sha(tmp_git_repo_dir, git_add, git_commit):
relative_config_path = ".cherry_picker.toml"
tmp_git_repo_dir.join(relative_config_path).write(
"""\
tmp_git_repo_dir.join(relative_config_path).write("""\
team = "python"
repo = "core-workfolow"
check_sha = "5f007046b5d4766f971272a0cc99f8461215c1ec"
default_branch = "devel"
"""
)
""")
git_add(relative_config_path)
git_commit(f"Add {relative_config_path}")

Expand Down Expand Up @@ -572,8 +566,7 @@ def test_normalize_long_commit_message():
title == "[3.6] Fix broken `Show Source` links on documentation pages (GH-3113)"
)
assert (
body
== """The `Show Source` was broken because of a change made in sphinx 1.5.1
body == """The `Show Source` was broken because of a change made in sphinx 1.5.1
In Sphinx 1.4.9, the sourcename was "index.txt".
In Sphinx 1.5.1+, it is now "index.rst.txt".
(cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69)
Expand All @@ -596,8 +589,7 @@ def test_normalize_short_commit_message():
title == "[3.6] Fix broken `Show Source` links on documentation pages (GH-3113)"
)
assert (
body
== """(cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69)
body == """(cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69)


Co-authored-by: Elmar Ritsch <35851+elritsch@users.noreply.github.com>"""
Expand Down Expand Up @@ -775,12 +767,10 @@ def test_paused_flow(tmp_git_repo_dir, git_add, git_commit):
initial_scm_revision = get_sha1_from("HEAD")

relative_file_path = "some.toml"
tmp_git_repo_dir.join(relative_file_path).write(
f"""\
tmp_git_repo_dir.join(relative_file_path).write(f"""\
check_sha = "{initial_scm_revision}"
repo = "core-workfolow"
"""
)
""")
git_add(relative_file_path)
git_commit("Add a config")
config_scm_revision = get_sha1_from("HEAD")
Expand Down
14 changes: 5 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ optional-dependencies.dev = [
urls.Homepage = "https://github.com/python/cherry-picker"
scripts.cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli"

[tool.hatch.version]
source = "vcs"
[tool.hatch]
build.hooks.vcs.version-file = "cherry_picker/_version.py"
version.source = "vcs"
# Change regex to match tags like "cherry-picker-v2.2.0".
tag-pattern = '^cherry-picker-(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'

[tool.hatch.build.hooks.vcs]
version-file = "cherry_picker/_version.py"

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
version.tag-pattern = "^cherry-picker-(?P<version>[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$"
version.raw-options.local_scheme = "no-local-version"

[tool.ruff]
fix = true
Expand Down
Loading