File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 209209 "default": None,
210210 "choices": version_types.VERSION_TYPES,
211211 },
212+ {
213+ "name": ["--empty"],
214+ "default": False,
215+ "help": "bump tags without new commits",
216+ "action": "store_true",
217+ },
212218 ],
213219 },
214220 {
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ def __call__(self): # noqa: C901
121121 is_files_only: Optional[bool] = self.arguments["files_only"]
122122 is_local_version: Optional[bool] = self.arguments["local_version"]
123123 manual_version = self.arguments["manual_version"]
124+ is_empty: Optional[bool] = self.arguments["empty"]
124125
125126 if manual_version:
126127 if increment:
@@ -175,7 +176,7 @@ def __call__(self): # noqa: C901
175176
176177 # No commits, there is no need to create an empty tag.
177178 # Unless we previously had a prerelease.
178- if not commits and not current_version_instance.is_prerelease:
179+ if not commits and not current_version_instance.is_prerelease and not is_empty :
179180 raise NoCommitsFoundError("[NO_COMMITS_FOUND]\n" "No new commits found.")
180181
181182 if manual_version:
@@ -208,6 +209,10 @@ def __call__(self): # noqa: C901
208209 if prerelease and current_version_instance.is_prerelease:
209210 increment = None
210211
212+ # we create an empty PATCH increment for empty tag
213+ if increment is None and is_empty:
214+ increment = "PATCH"
215+
211216 new_version = bump.generate_version(
212217 current_version,
213218 increment,
You can’t perform that action at this time.
0 commit comments