Skip to content

Commit 2d65bfa

Browse files
gpongelliLee-W
authored andcommitted
align naming convention to git standard
1 parent 9cb0cb8 commit 2d65bfa

File tree

5 files changed

+33
-25
lines changed

5 files changed

+33
-25
lines changed

commitizen/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@
156156
"action": "store_true",
157157
},
158158
{
159-
"name": ["--annotated-tag", "-at"],
159+
"name": ["--annotate", "-a"],
160160
"help": "create annotated tag instead of lightweight one",
161161
"action": "store_true",
162162
},
163163
{
164-
"name": ["--signed-tag", "-st"],
164+
"name": ["--sign", "-s"],
165165
"help": "sign tag instead of lightweight one",
166166
"default": False,
167167
"action": "store_true",

commitizen/commands/bump.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def __init__(self, config: BaseConfig, arguments: dict):
4040
"prerelease",
4141
"increment",
4242
"bump_message",
43-
"annotated_tag",
44-
"signed_tag",
43+
"annotate",
44+
"gpg_sign",
4545
]
4646
if arguments[key] is not None
4747
},
@@ -232,10 +232,10 @@ def __call__(self): # noqa: C901
232232
raise BumpCommitFailedError(f'2nd git.commit error: "{c.err.strip()}"')
233233
c = git.tag(
234234
new_tag_version,
235-
annotated=self.bump_settings.get("annotated_tag", False)
236-
or bool(self.config.settings.get("annotated_tag", False)),
237-
signed=self.bump_settings.get("signed_tag", False)
238-
or bool(self.config.settings.get("signed_tag", False)),
235+
annotated=self.bump_settings.get("annotate", False)
236+
or bool(self.config.settings.get("annotate", False)),
237+
signed=self.bump_settings.get("gpg_sign", False)
238+
or bool(self.config.settings.get("gpg_sign", False)),
239239
)
240240
if c.return_code != 0:
241241
raise BumpTagFailedError(c.err)

docs/bump.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog]
5858
[--no-verify] [--yes] [--tag-format TAG_FORMAT]
5959
[--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}]
6060
[--increment {MAJOR,MINOR,PATCH}] [--check-consistency]
61-
[--annotated-tag] [--signed-tag] [--changelog-to-stdout] [--retry]
61+
[--annotate] [--sign] [--changelog-to-stdout] [--retry]
6262

6363
options:
6464
-h, --help show this help message and exit
@@ -82,8 +82,8 @@ options:
8282
--check-consistency, -cc
8383
check consistency among versions defined in commitizen
8484
configuration and version_files
85-
--annotated-tag, -at create annotated tag instead of lightweight one
86-
--signed-tag, -st create a signed tag instead of lightweight one or annotated tag
85+
--annotate, -a create annotated tag instead of lightweight one
86+
--sign, -s create a signed tag instead of lightweight one or annotated tag
8787
--changelog-to-stdout
8888
Output changelog to the stdout
8989
--retry retry commit if it fails the 1st time
@@ -163,9 +163,9 @@ version = "5.3.5+0.1.0"
163163
164164
If `--local-version` is used, it will bump only the local version `0.1.0` and keep the public version `5.3.5` intact, bumping to the version `5.3.5+0.2.0`.
165165
166-
### `--annotated-tag`
166+
### `--annotate`
167167
168-
If `--annotated-tag` is used, commitizen will create annotated tags. Also available via configuration, in `pyproject.toml` or `.cz.toml`.
168+
If `--annotate` is used, commitizen will create annotated tags. Also available via configuration, in `pyproject.toml` or `.cz.toml`.
169169
170170
### `--changelog-to-stdout`
171171
@@ -356,13 +356,24 @@ update_changelog_on_bump = true
356356
357357
---
358358
359-
### `annotated_tag`
359+
### `annotate`
360360
361361
When set to `true` commitizen will create annotated tags.
362362
363363
```toml
364364
[tool.commitizen]
365-
annotated_tag = true
365+
annotate = true
366+
```
367+
368+
---
369+
370+
### `gpg_sign`
371+
372+
When set to `true` commitizen will create gpg signed tags.
373+
374+
```toml
375+
[tool.commitizen]
376+
gpg_sign = true
366377
```
367378
368379
## Custom bump

docs/config.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,14 @@ commitizen:
123123
## Settings
124124
125125
| Variable | Type | Default | Description |
126-
| -------------------------- | ------ | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
126+
|----------------------------| ------ | --------------------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
127127
| `name` | `str` | `"cz_conventional_commits"` | Name of the committing rules to use |
128128
| `version` | `str` | `None` | Current version. Example: "0.1.2" |
129129
| `version_files` | `list` | `[ ]` | Files were the version will be updated. A pattern to match a line, can also be specified, separated by `:` [See more][version_files] |
130130
| `tag_format` | `str` | `None` | Format for the git tag, useful for old projects, that use a convention like `"v1.2.1"`. [See more][tag_format] |
131131
| `update_changelog_on_bump` | `bool` | `false` | Create changelog when running `cz bump` |
132-
| `annotated_tag` | `bool` | `false` | Use annotated tags instead of lightweight tags. [See difference][annotated-tags-vs-lightweight] |
132+
| `annotate` | `bool` | `false` | Use annotated tags instead of lightweight tags. [See difference][annotated-tags-vs-lightweight] |
133+
| `sign` | `bool` | `false` | Use gpg signed tags instead of lightweight tags. |
133134
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more][bump_message] |
134135
| `allow_abort` | `bool` | `false` | Disallow empty commit messages, useful in ci. [See more][allow_abort] |
135136
| `changelog_file` | `str` | `CHANGELOG.md` | filename of exported changelog |

tests/commands/test_bump_command.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_bump_minor_increment(commit_msg, mocker):
5959
@pytest.mark.usefixtures("tmp_commitizen_project")
6060
def test_bump_minor_increment_annotated(commit_msg, mocker):
6161
create_file_and_commit(commit_msg)
62-
testargs = ["cz", "bump", "--yes", "--annotated-tag"]
62+
testargs = ["cz", "bump", "--yes", "--annotate"]
6363
mocker.patch.object(sys, "argv", testargs)
6464
cli.main()
6565
tag_exists = git.tag_exist("0.2.0")
@@ -74,7 +74,7 @@ def test_bump_minor_increment_annotated(commit_msg, mocker):
7474
@pytest.mark.usefixtures("tmp_commitizen_project_with_gpg")
7575
def test_bump_minor_increment_signed(commit_msg, mocker):
7676
create_file_and_commit(commit_msg)
77-
testargs = ["cz", "bump", "--yes", "--signed-tag"]
77+
testargs = ["cz", "bump", "--yes", "--gpg-sign"]
7878
mocker.patch.object(sys, "argv", testargs)
7979
cli.main()
8080
tag_exists = git.tag_exist("0.2.0")
@@ -90,9 +90,7 @@ def test_bump_minor_increment_annotated_config_file(
9090
commit_msg, mocker, tmp_commitizen_project
9191
):
9292
tmp_commitizen_cfg_file = tmp_commitizen_project.join("pyproject.toml")
93-
tmp_commitizen_cfg_file.write(
94-
f"{tmp_commitizen_cfg_file.read()}\n" f"annotated_tag = 1"
95-
)
93+
tmp_commitizen_cfg_file.write(f"{tmp_commitizen_cfg_file.read()}\n" f"gpg_sign = 1")
9694
create_file_and_commit(commit_msg)
9795
testargs = ["cz", "bump", "--yes"]
9896
mocker.patch.object(sys, "argv", testargs)
@@ -110,9 +108,7 @@ def test_bump_minor_increment_signed_config_file(
110108
commit_msg, mocker, tmp_commitizen_project_with_gpg
111109
):
112110
tmp_commitizen_cfg_file = tmp_commitizen_project_with_gpg.join("pyproject.toml")
113-
tmp_commitizen_cfg_file.write(
114-
f"{tmp_commitizen_cfg_file.read()}\n" f"signed_tag = 1"
115-
)
111+
tmp_commitizen_cfg_file.write(f"{tmp_commitizen_cfg_file.read()}\n" f"gpg_sign = 1")
116112
create_file_and_commit(commit_msg)
117113
testargs = ["cz", "bump", "--yes"]
118114
mocker.patch.object(sys, "argv", testargs)

0 commit comments

Comments
 (0)