GeezerVison is showing github.com — refactor(bump): rename --empty as --allow-no-commit · commitizen-tools/commitizen@685e4ee
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: commitizen/cli.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -372,9 +372,9 @@ def __call__( |
372 | 372 | "default": False, |
373 | 373 | }, |
374 | 374 | { |
375 | | - "name": ["--empty"], |
| 375 | + "name": ["--allow-no-commit"], |
376 | 376 | "default": False, |
377 | | - "help": "bump tags without new commits", |
| 377 | + "help": "bump version without eligible commits", |
378 | 378 | "action": "store_true", |
379 | 379 | }, |
380 | 380 | ], |
|
Collapse file
Copy file name to clipboardExpand all lines: commitizen/commands/bump.py +7-3Lines changed: 7 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -160,7 +160,7 @@ def __call__(self) -> None: # noqa: C901 |
160 | 160 | build_metadata = self.arguments["build_metadata"] |
161 | 161 | increment_mode: str = self.arguments["increment_mode"] |
162 | 162 | get_next: bool = self.arguments["get_next"] |
163 | | - is_empty: bool | None = self.arguments["empty"] |
| 163 | + allow_no_commit: bool | None = self.arguments["allow_no_commit"] |
164 | 164 |
|
165 | 165 | if manual_version: |
166 | 166 | if increment: |
@@ -251,7 +251,11 @@ def __call__(self) -> None: # noqa: C901 |
251 | 251 |
|
252 | 252 | # No commits, there is no need to create an empty tag. |
253 | 253 | # Unless we previously had a prerelease. |
254 | | - if not commits and not current_version.is_prerelease and not is_empty: |
| 254 | + if ( |
| 255 | + not commits |
| 256 | + and not current_version.is_prerelease |
| 257 | + and not allow_no_commit |
| 258 | + ): |
255 | 259 | raise NoCommitsFoundError( |
256 | 260 | "[NO_COMMITS_FOUND]\nNo new commits found." |
257 | 261 | ) |
@@ -268,7 +272,7 @@ def __call__(self) -> None: # noqa: C901 |
268 | 272 | ) |
269 | 273 |
|
270 | 274 | # we create an empty PATCH increment for empty tag |
271 | | - if increment is None and is_empty: |
| 275 | + if increment is None and allow_no_commit: |
272 | 276 | increment = "PATCH" |
273 | 277 |
|
274 | 278 | new_version = current_version.bump( |
|